-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
118 lines (93 loc) · 2.6 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
set nocompatible
syntax on
filetype plugin indent on
set shortmess+=I
" Use comma as a leader key
let mapleader=","
" Leader spell-checking
nnoremap <silent> <leader>se :call ToggleSpellLang("en_us")<cr>
nnoremap <silent> <leader>sf :call ToggleSpellLang("fr")<cr>
function! ToggleSpellLang(lang)
if &spelllang == a:lang
if &spell
setlocal nospell
else
setlocal spell
endif
else
let &spelllang=a:lang
setlocal spell
endif
endfunction
" Replace pattern in multiple files
" Invocation :AllS **/*.h:foo/bar/gc
function! AllS(input)
let colonIndex = stridx(a:input,':')
let files = strpart(a:input,0,colonIndex)
let pattern = strpart(a:input,colonIndex+1)
execute 'args ' . files
execute 'silent argdo %' . pattern . 'e | update'
endfunction
:command! -nargs=1 AllS :call AllS(<f-args>)
" Leader highlighted 80th column
nnoremap <silent> <leader>c :call ToggleColorColumn80()<cr>
function! ToggleColorColumn80()
if &colorcolumn
setlocal colorcolumn=
else
setlocal colorcolumn=80
endif
endfunction
map <leader>t <C-]>
nnoremap <leader>. :CtrlPTag<cr>
" Leader alternate file
nnoremap <leader>a :FSHere<cr>
" I'm used to Ctrl-^ opening the file navigator
" It's pretty much always the case, until you start using ",a"
" So make sure it sticks!
nnoremap <C-^> :buffer NERD_tree<cr>
" Turn on line numbers, relatively
set number
set relativenumber
" Insert spaces, not tabs
set expandtab
" Ensure the cursor stays away from the top/bottom
set so=8
" UTF8 or die
set encoding=utf8
" One level of indentation is two spaces
set shiftwidth=2
" Show trailing whitespace
set listchars=tab:›\ ,trail:▒
set list
" Tabs are 4 spaces long
set tabstop=4
if has("gui_macvim")
let macvim_hig_shift_movement = 1
endif
" Default completion type = known words
let g:SuperTabDefaultCompletionType = "<c-x><c-n>"
set background=light
if !has('gui_running')
set background=dark
"#let g:solarized_termtrans=1
end
colorscheme solarized
" Status line
set laststatus=2
set statusline=%t\ "tail of the filename
set statusline+=[%{strlen(&fenc)?&fenc:'none'}]
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%y "filetype
set statusline+=%= "left/right separator
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "p
" Configure NERDTree
let NERDTreeHijackNetrw=1
let NERDTreeMinimalUI=1
let NERDTreeCustomOpenArgs = {'file': {'reuse': '', 'where': 'p'}, 'dir': {}}
highlight NERDTreeOpenable ctermfg=1
highlight NERDTreeClosable ctermfg=1