summaryrefslogtreecommitdiff
path: root/src/.vimrc
blob: b8d44225aaf794405ea527c1fbfc27921cd3be0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
syntax on

colorscheme ice

" Your usual config below
set number
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set autoindent
set smartindent
set scrolloff=999
set mouse=a

""""""""""""""""""""""""""""""""""""""""""
" Statubar

function! VisualModeLineCount()
  if mode() =~# 'v'
    return '['.(line("'>") - line("'<") + 1).' lines selected]'
  endif
  return ''
endfunction

function! ModifiedFlag()
  if &modified
    return '[Modified]'    " Your custom text
  endif
  return ''                 " Empty if not modified
endfunction

function! ReadOnlyFlag()
  if &readonly
    return '[Read-only]'    " Your custom text
  endif
  return ''                 " Empty if not modified
endfunction

" Full-width statusline
set laststatus=2
set statusline=

" LEFT Side
set statusline=
set statusline+=%f                          " File name
set statusline+=\ [%l:%c]                   " Line and column
set statusline+=\ [%L/%p%%]                 " Total lines and percent
set statusline+=%{VisualModeLineCount()}    " Selected lines in visual mode
set statusline+=%{ModifiedFlag()}           " Custom modified flag

" CENTER filler (optional)
set statusline+=%=

" RIGHT side
set statusline+=\ [%y]                " Filetype
set statusline+=%{ReadOnlyFlag()}

""""""""""""""""""""""""""""""""""""""""""

" Status bar transparent
hi StatusLine ctermbg=0 cterm=NONE
   
" Cursor can rest beyond the last character
set virtualedit=onemore

" Highlight
set hlsearch

" Disable expandtab for make files
autocmd FileType make setlocal noexpandtab

" System clipboard
if has("clipboard")
  set clipboard=unnamedplus
endif

" F2: absolute numbers only
nnoremap <F2> :set number!<CR>

" F4: absolute numbers only
nnoremap <F4> :set relativenumber!<CR>

" Search highlight
nnoremap <F5> :nohlsearch<CR>

if &term =~ 'tmux\|xterm\|konsole'
  " Map HOME key to move to beginning of line in normal mode
  noremap <Esc>[1~ 0
  noremap <Esc>[H 0
  noremap <Esc>OH 0
endif

" Colors
if has('termguicolors')
  set termguicolors
endif