-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vanillavimrc
197 lines (140 loc) · 3.7 KB
/
.vanillavimrc
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Creator:
" Cristian A. Cardellino
" https://crscardellino.github.io
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" =======
" General
" =======
" keep 500 lines of command line history
set history=500
" use 100 levels of undo
set undolevels=100
" set endline to unix-style
set ff=unix
" change the terminal's title
set title
" <leader> and <localleader>
let mapleader = ","
let maplocalleader = "\\"
" capital "Q" to quit all
command Q :qall
" capital "W" to write all
command W :wall
" capital "WQ" to write and quit all
command WQ :wall | :qall
" "Vimrc" to edit the .vimrc file
command Vimrc :tabe ~/.vimrc
" =================
" Buffers & Windows
" =================
" don't force close of buffers
set hidden
" Buffer switching
nnoremap <leader>n :bn<cr>
nnoremap <leader>p :bp<cr>
" Tab switching
nnoremap <localleader>n :tabnext<cr>
nnoremap <localleader>p :tabprevious<cr>
" Resize
nnoremap <localleader>[ :vertical resize -5<cr>
nnoremap <localleader>] :vertical resize +5<cr>
nnoremap <localleader>{ :res -5<cr>
nnoremap <localleader>} :res +5<cr>
" ==============
" Edition & Text
" ==============
" syntax highlighting
syntax on
" word wrap
set textwidth=0
" highlight column 80
set colorcolumn=80
" insert newline character
nmap <c-o> O<esc>j
" insert newline
nnoremap <cr> a<cr><esc>k$
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" size of a hard tabstop
set tabstop=4
" size of an "indent"
set shiftwidth=4
" a combination of spaces and tabs are used to simulate tab stops at a width
" other than the (hard)tabstop
set softtabstop=4
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" always uses spaces instead of tab characters
set expandtab
" don't wrap lines
set nowrap
" always set autoindenting on
set autoindent
" copy the previous indentation on autoindenting
set copyindent
" toggle pastemode
set pastetoggle=<F2>
" set new vertical splits to the right and horizontal to below
set splitright
set splitbelow
" set different tabspaces for some files
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype tex setlocal ts=2 sts=2 sw=2
" ===================
" Files & Directories
" ===================
" change the dir
set autochdir
" Remove temp files created by vim
set nobackup
set noundofile
" set to auto read when a file is changed from the outside
set autoread
" set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Ignore this files when using wildcards
set wildignore=*.swp,*.bak,*.pyc,*.class,.git/,tmp/
" =========
" Interface
" =========
" show the cursor position all the time
set ruler
" display incomplete commands
set showcmd
" show line number
set number
" background type
set background=dark
" show matching brackets when text indicator is over them
set showmatch
" remove trailing whitespaces with <F5>
:nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
" ======
" Moving
" ======
" treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Smart way to move between windows
map <c-j> <c-w>j:cd %:p:h<cr>:<cr>
map <c-k> <c-w>k:cd %:p:h<cr>:<cr>
map <c-h> <c-w>h:cd %:p:h<cr>:<cr>
map <c-l> <c-w>l:cd %:p:h<cr>:<cr>
" Tab to switch windows
map <tab> <c-w>w:cd %:p:h<cr>:<cr>
" continue to next and previous line when moving
set whichwrap+=<,>,h,l,[,]
" ======
" Search
" ======
" do incremental searching
set incsearch
" highlight search results
set hlsearch
" ignore case while searching
set ignorecase
" case-sensitive is patter is not all-lowercase
set smartcase