/
vimrc
234 lines (186 loc) · 6.39 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
224
225
226
227
228
229
230
231
232
""""pathogen
execute pathogen#infect()
filetype plugin on
" IMPORTANT: Uncomment one of the following lines to force
" " using 256 colors (or 88 colors) if your terminal supports it,
" " but does not automatically use 256 colors by default.
set t_Co=256
" "set t_Co=88
" let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
" colorscheme apprentice
"COLORSCHEME
syntax enable
set background=dark
colorscheme base16-ateliersavanna
" or, for the light background mode:
" set background=light
" colorscheme base16-atelierdune
" or any of the other schemes:
" colorscheme base16-atelierforest
" colorscheme base16-atelierplateau
" colorscheme base16-atelierheath
" colorscheme base16-ateliercave
" colorscheme base16-ateliersulphurpool
" colorscheme base16-atelierlakeside
" colorscheme base16-atelierseaside
" colorscheme base16-atelierdune
" colorscheme base16-atelierestuary
let g:airline_theme='one'
" let g:csv_autocmd_arrange = 1
syn on
syntax enable
set number
" Be smart when using tabs ;)
set smarttab
set expandtab
set shiftwidth=2
set tabstop=2
set shortmess+=filmnrxoOtT " abbrev. of messages (avoids 'hit enter')
set viewoptions=folds,options,cursor,unix,slash " better unix / windows compatibility
set virtualedit=onemore " allow for cursor beyond last character
set history=1000 " Store a ton of history (default is 20)
set showmode " display the current mode
if has('cmdline_info')
set ruler " show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set showcmd " show partial commands in status line and
" selected characters/lines in visual mode
endif
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
set noshowmode
" Linebreak on 500 characters
"set lbr
"set tw=500
set autoindent
" set si "Smart indent
set wrap "Wrap lines
set incsearch " find as you type search
set backspace=indent,eol,start " backspace for dummies
set linespace=0 " No extra spaces between rows
set showmatch " show matching brackets/parenthesis
set hlsearch " highlight search terms
set winminheight=0 " windows can be 0 line high
set ignorecase " case insensitive search
set smartcase " case sensitive when uc present
set wildmenu " show list instead of just completing
set wildmode=list:longest,full
set wildignore=*.meta
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
" set foldenable " auto fold code
set list
set listchars=tab:,.,extends:#,nbsp:. " Highlight problematic whitespace
" make . work with visually selected lines
xnoremap . :norm.<CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" " Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
let mapleader = "\<Space>"
nnoremap <Leader>w :w<CR>
nnoremap <Leader>o :w<CR>
nnoremap <Leader><Space> :w<CR>
"new line above or below
nnoremap <Leader>L :pu! _<CR>:']+1<CR>
nnoremap <Leader>l :pu _<CR>:'[-1<CR>
" "Dash search
" :nmap <silent> <leader>d <Plug>DashSearch
"MOVEMENT
nnoremap j gj
nnoremap k gk
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
"CAPS->HELP->ESC?
map <Help> <Esc>
map! <Help> <Esc>
map <Insert> <Esc>
map! <Insert> <Esc>
"toggle line numbers
nmap \1 :setlocal number!<CR>
"toggle paste
nmap \p :set paste!<CR>
cmap w!! w !sudo tee % >/dev/null
"ARDUINO
au BufRead,BufNewFile *.ino set filetype=arduino
call tcomment#DefineType('arduino', '//%s')
"C
au BufRead,BufNewFile *.c set filetype=c
call tcomment#DefineType('c', '//%s')
nnoremap <silent> <leader>f :CtrlP<CR>
nnoremap <silent> <leader>; :CtrlPBuffer<CR>
" nnoremap <silent> <leader>r :CtrlPClearAllCaches<CR>
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$|node_modules$',
\ 'file': '\.exe$\|\.so$\|\.dll$' }
let g:ctrlp_clear_cache_on_exit = 1
let g:ctrlp_mruf_relative = 1
let g:ctrlp_working_path_mode = 0
let g:ctrlp_dotfiles = 0
let g:ctrlp_switch_buffer = 0
let g:netrw_silent = 1
" When the type of shell script is /bin/sh, assume a POSIX-compatible
" " shell for syntax highlighting purposes.
let g:is_posix = 1
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
"Gundo
nnoremap <F5> :GundoToggle<CR>
"next and previous buffer
nmap <leader>n :bn<CR>
nmap <leader>b :bp<CR>
"more natural split opening
set splitbelow
set splitright
"Easier split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" vv to generate new vertical split
nnoremap <silent> vv <C-w>v
nnoremap <silent> zz <C-w>n
"fzf
set rtp+=/usr/local/opt/fzf
""""""""""""""""""""""""""""""""""
"Vimux
""""""""""""""""""""""""""""""""""
let g:VimuxUseNearest =1
" Prompt for a command to run
map <Leader>vp :VimuxPromptCommand<CR>
" Run last command executed by VimuxRunCommand
map <Leader>vl :VimuxRunLastCommand<CR>
" Inspect runner pane
map <Leader>vi :VimuxInspectRunner<CR>
" Zoom the tmux runner pane
map <Leader>vz :VimuxZoomRunner<CR>
" Close normal app & run command
nnoremap <Leader>r :w<CR> :call VimuxSendKeys("^C")<CR> :VimuxRunLastCommand<CR>
" Close esp32 monitor & run command
nnoremap <Leader>u :w<CR> :call VimuxSendKeys("^]")<CR> :VimuxRunLastCommand<CR>
" Kill normal command
nnoremap <Leader>vk :call VimuxSendKeys("^C")<CR>
" Kill esp32 monitor
nnoremap <Leader>v] :call VimuxSendKeys("^]")<CR>
let g:tmux_navigator_save_on_switch =1
let g:tmux_navigator_disable_when_zoomed = 1
"try the built-in make
nnoremap <Leader>m :make<CR>
autocmd QuickFixCmdPost * copen
autocmd FileType python setlocal expandtab shiftwidth=4
" " autosource vimrc
" augroup VimrcSource
" " autocmd! " Remove all autocmd's for the VimrcSource group
" autocmd BufWritePost .vimrc source $MYVIMRC
" augroup END
set viminfo^=%