-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
146 lines (121 loc) · 4.67 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
set nocompatible
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"-------------------------------- Baseline
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""{{{1
""" General {{{2
set encoding=utf-8
set t_Co=256
set nowrap
set mouse=a
let &colorcolumn=join(range(81,121),",")
filetype plugin indent on
syntax on
" }}}2
""" Tabs and Indentantion {{{2
set expandtab " use spaces instead of tab
set tabstop=4 " set tab to spaces
set autoindent " copy indent from the current line to the new line
set copyindent " copy indent characters from the current line to the new line
set shiftwidth=4 " use spaces when autoindenting
set smarttab " use shiftwidth when inserting on the start of the line
set backspace=2 " backspace over autoindent, eol and start of insert
" }}}2
""" Display and Highlight {{{2
set title " change terminal title
set number " display line numbers
set showcmd " displays the commands you type
set cursorline " underline the current line
set cursorcolumn " add vertical line ass well
set showmatch " show matching parenthesis
set listchars=tab:»·,trail:.,extends:#,nbsp:.
set list " display whitespace and other listchars
set scrolloff=1 " set minimal lines to keep above or below cursor
set sidescrolloff=5 " set minimal lines to the right side of the cursor
set laststatus=2 " always display status line
" }}}2
""" Search and Command-line {{{2
set ignorecase " ignore case when searching
set smartcase " ignore case if pattern is lowercase
set hlsearch " highlight search results
set incsearch " show matches per character
set wildmenu " display possible matches for command-line comletion
" }}}2
""" History and Backups {{{2
set autoread " reload if file changed outside Vim
set nobackup " don't keep backup files
set noswapfile " don't keep swap files
set history=1000 " increase command and search history
set undolevels=1000 " increase undo levels
set undofile " keep and store undo file in first available location
set undodir=~/.vim/.undo,~/tmp,/tmp
" }}}2
""" Windows and Buffers {{{2
set hidden " hide buffer instead of closing it
set splitbelow " split below when using :sp
set splitright " split to the right when using :vs
" }}}2
""" Folds {{{2
set foldenable " enable folds
set foldlevel=99 " all unfolded at start
set foldcolumn=1 " display side column with folds
set foldmethod=marker " fold only when provided markers such 3x{
set foldopen=search " auto-unfold under listed conditions
" }}}2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}1
"-------------------------------- Mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""{{{1
""" Normal mode {{{2
" map leader to space and switch : and ;
let mapleader = " "
nnoremap ; :
nnoremap : ;
" quick edit and quick reload of .vimrc and .vimrc.bundles
nnoremap <silent> <leader>vv :vsplit $MYVIMRC<CR>
nnoremap <silent> <leader>vb :vsplit $MYVIMRC.bundles<CR>
nnoremap <silent> <leader>vs :so $MYVIMRC<CR>
"insert new line below without going into INSERT
nnoremap <CR> o<Esc>
"clear highlight after search
nnoremap <silent> <leader>/ :noh<CR><Esc>
" better window navigation
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" better buffer navigation
nnoremap <leader><Left> :bprevious<CR>
nnoremap <leader><Right> :bnext<CR>
" toggle spellcheck
nnoremap <silent> <leader>S :setlocal spell! spelllang=en_us<CR>
" }}}2
""" Insert mode {{{2
" type jj to return to NORMAL from INSERT
inoremap jj <Esc>
" }}}2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}1
"-------------------------------- Autocomands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""{{{1
if has("autocmd")
augroup git "{{{2
autocmd!
autocmd Filetype gitcommit setlocal colorcolumn=72
augroup END " }}}2
augroup Misc_Global "{{{2
autocmd!
autocmd Filetype ruby,markdown,gitcommit setlocal spell spelllang=en_us
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
autocmd BufRead TODO setlocal syntax=abel
augroup END " }}}2
endif " has("autocmd")
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}1
"-------------------------------- Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""{{{1
" include plugin manager config
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" include local config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""}}}1