-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
vimrc
95 lines (95 loc) · 4.05 KB
/
vimrc
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
" https://github.com/drduh/config/blob/master/vimrc
" https://vimhelp.org/vim_faq.txt.html
set nocompatible
filetype plugin indent on
syntax on
noremap ; :
noremap <C-a> <Home>
noremap <C-e> <End>
noremap <C-h> :tabNext<cr>
noremap <C-l> :tabnext<cr>
noremap <C-n> :tabnew<cr>
noremap <space><cr> :nohlsearch<cr>
noremap <space><del> :quit!<cr>
noremap <space><space> :set list!<cr>
noremap <space>exec :!./%<cr>
noremap <space>ws :%s/\s\+$//<cr>
noremap <space>s :setlocal spell!<cr>
set autoindent " copy indent from current line
set cursorline " underline cursor line
set expandtab " use spaces instead of tabs
set gdefault " use g flag to search/replace
set hidden " switch buffers without saving
set hlsearch " highlight searches
set ignorecase " ignore case when searching
set incsearch " dynamic pattern highlighting
set lazyredraw " no re-draw on untyped commands
set linebreak " break on breakat chars
set magic " magic search strings
set noeol " no newline at eof
set noerrorbells " disable error bells
set nomodeline " disable mode lines
set nostartofline " do not reset cursor to line start when moving
set noswapfile " no swap files
set number " enable line numbers
set paste " always use paste mode
set relativenumber " use line numbers relative to cursor
set showcmd " show partial command as it is typed
set showmatch " show matching brackets
set showmode " show current mode
set smartcase " do not ignore capital letter search
set title " set window title
set ttyfast " optimize for fast terminal connections
set wildmenu " enhanced completion
set wrap " wrap lines
set backspace =2 " intuitive backspacing in insert mode
set cmdheight =2 " never prompt for enter or command
set encoding =utf-8 nobomb " use utf-8 wo bom
set history =200 " line history
set laststatus =2 " always show status line
set scrolloff =3 " scroll 3 lines before horizontal border
set shiftwidth =2 " set tab to 2 spaces
set shortmess =atsI " mute intro message
set softtabstop =2 " make tabs as wide as two spaces
set tabpagemax =2 " maximum 2 tabs
set tabstop =2 " make tabs as wide as two spaces
set updatetime =2000 " write every 2 seconds
set backupdir =~/.vim/backup " backup
set directory =~/.vim/swap " swap
set undodir =~/.vim/undo " undo
set statusline = " set status line
set statusline +=\ 0x%04B\ %* " character under cursor
set statusline +=%#LineNr#%= " spacer
set statusline +=\ %F " file path
set statusline +=\%m\ %* " file mode
set statusline +=\ %{WC()}\ " number of words
set statusline +=\%l/%L\ " number of lines
set viminfo ="" " disable viminfo
"set viminfo ='10 " edited files
"set viminfo +=/10 " pattern items
"set viminfo +=n~/.vim/info " viminfo file name
let g:wc =''
function WC()
return g:wc
endfunction
function UpdateWordCount()
let lnum=1
let n=0
while lnum<=line('$')
let lnum=lnum+1
let n=n+len(split(getline(lnum)))
endwhile
let g:wc=n
endfunction
augroup WordCounter
au! CursorHold,CursorHoldI * call UpdateWordCount()
augroup END
hi Normal ctermfg=14 ctermbg=8
hi LineNr ctermfg=10 ctermbg=0
hi Comment ctermfg=9 ctermbg=0
hi StatusLine ctermfg=0 ctermbg=3
hi clear SpellBad
hi SpellBad ctermbg=10
colorscheme solarized
autocmd BufRead,InsertLeave * match ExtraWhitespace /\s\+$/
highlight ExtraWhitespace ctermbg=red