-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
223 lines (181 loc) · 5.26 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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
set nocompatible
language messages C
set nobackup
set noswapfile
set ignorecase
set shiftwidth=4
set tabstop=4
set expandtab
set iminsert=0
set imsearch=-1
set iskeyword=@,48-57,_
imap <C-\> <C-^>
cmap <C-\> <C-^>
set encoding=utf-8
set hidden
set showmatch
set smartcase
set ch=2 " Make command line two lines high
set mousehide " Hide the mouse when typing text
set mouse=n " mouse positioning is only allowed in normal mode
set guioptions-=T
set guioptions-=m
" Format comments.
set formatoptions+=crq
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set incsearch
set bs=indent,eol,start
set modeline
set modelines=3
set autoread " automatically reload files from disk when changed
let c_comment_strings=1
if !exists("syntax_on")
syntax on
endif
set hlsearch
set cursorline
set nofoldenable
set foldmethod=manual
set number
if $TERM =~ ".*-256color$" || $COLORTERM == "gnome-terminal"
set t_Co=256
endif
set guifont="JetBrains Mono":h13
set shell=fish
set bg=dark
colo solarized8
set bg=dark
filetype on
filetype plugin on
filetype indent on
let g:tex_flavor='latex'
let mapleader=","
let g:mapleader=","
nmap <silent> <Leader>ev :e $MYVIMRC<CR>
nmap <silent> <Leader>sv :so $MYVIMRC<CR>
nnoremap <silent> <TAB><TAB> :set invwrap<CR>
nnoremap ; :
nnoremap <silent> <Leader>ln :set invnu<CR>
nnoremap <silent> <Leader>cd :cd %:h<CR>
nnoremap <silent> <Leader>rm :%s/\r//g<CR>:g/^$/d<CR>
nnoremap <silent> <Leader>\ :s/\\/\\\\/g<CR>
nmap <silent> <S-Tab> :bnext<CR>
nnoremap <silent> <C-h> :b#<CR>
nnoremap <silent> <Leader>ww :BD<CR>
nnoremap <silent> <Leader>w! :BD!<CR>
nnoremap <silent> <Leader>wq :BD!<CR>
nnoremap <silent> <Leader>- <C-W>K
nnoremap <silent> <Leader>\ <C-W>H
" QuickFix navigation
nnoremap <silent> <Leader>cn :cn<CR>
nnoremap <silent> <Leader>cp :cp<CR>
nnoremap <silent> <Leader>cN :cnf<CR>
nnoremap <silent> <Leader>cP :cpf<CR>
" HARDCORE!
"map <up> <nop>
"map <down> <nop>
"map <left> <nop>
"map <right> <nop>
"inoremap <up> <nop>
"inoremap <down> <nop>
"inoremap <left> <nop>
"inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
nmap <silent> <ESC><ESC> :nohlsearch<CR>
"nnoremap <silent> <space> za
nmap <silent> <Leader>n :NERDTreeToggle<CR>
nmap <silent> <Leader>1 :NERDTreeToggle<CR>
nmap <silent> <Leader>m :NERDTreeFind<CR>
nmap <silent> <Leader>N :NERDTreeClose<CR>
nnoremap Q <nop>
nnoremap q: <nop>
nnoremap q? <nop>
nnoremap q/ <nop>
" Persistent undo
set undofile
set undodir=$HOME/.vimundo " Where to save undo histories
set ur=100000
" NERDTree settings
let NERDTreeIgnore=['\.pyc$', '\.pyo$', '\.obj$', '\.git$', '.DS_Store$']
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=0
let NERDTreeHighlightCursorLine=1
" Map <C-A> to go to the beginning of the line, and <C-E> to go to the end of
" the line.
cnoremap <C-A> <C-B>
inoremap <C-A> <Esc>I
inoremap <C-E> <Esc>A
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
set laststatus=2
" statusline
" cf the default statusline: %<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" format markers:
" %< truncation point
" %n buffer number
" %f relative path to file
" %m modified flag [+] (modified), [-] (unmodifiable) or nothing
" %r readonly flag [RO]
" %y filetype [ruby]
" %{&enc} current encoding used
" %{&fenc} current file encoding
" %= split point for left and right justification
" %-35. width specification
" %l current line number
" %L number of lines in buffer
" %c current column number
" %V current virtual column number (-n), if different from %c
" %P percentage through buffer
" %) end of width specification
set statusline=%<\ %n:%f\ %m%r%y\ \[%{&enc}\]\ \[%{&fenc}\]%=%-35.(line:\ %l\ of\ %L,\ col:\ %c%V\ (%P)%)
set wildignore=*.o,*.exe,*.obj,*.pyc,*.pyd,*.hsi,*.beam,*.dll,*.class,.DS_Store
" Always enable rainbow parentheses
au VimEnter * RainbowParenthesesActivate
au ColorScheme * RainbowParenthesesActivate
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
nnoremap <silent> <Leader>rp :RainbowParenthesesToggle<CR>
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
cnoreabbrev Ack Ack!
cnoreabbrev ack Ack!
cnoreabbrev ag Ack!
"cnoreabbrev AckFromSearch AckFromSearch!
nnoremap <leader>a :Ack!<space>
nnoremap <leader>* :Ack!<cr>
"nnoremap <leader>af :AckFromSearch!<cr>
" UI
set wildmenu
set wildmode=longest:full,full
set wildignore+=*.so,*.zip,*.o,*.a
set wildignore+=.git\*,.hg\*,.svn\*
" fzf
set rtp+=/opt/homebrew/opt/fzf
nnoremap <Leader>p :Files<CR>
nnoremap <leader>g :GFiles<CR>
" include any local configuration
let local_config = expand('~/.vim_local')
if filereadable(local_config)
execute 'source'.fnameescape(local_config)
endif
" tmux repeat last action
if executable('tmux')
nnoremap <silent> \r :echo "Gotta use the leader!"<CR>
nnoremap <silent> <Leader>rr :!tmux send-keys -t {right-of} C-p C-j <CR><CR>
endif
let g:lightline = { 'colorscheme': 'darcula' }
" Force refresh the buffer when it has been modified externally
nmap <Leader>ee :e!<CR>
nmap <Leader>cc <plug>NERDCommenterToggle
if !has('nvim')
" neovim has this already
packadd! editorconfig
set matchpairs=(:),{:},[:],<:>
runtime macros/matchit.vim
endif