-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
196 lines (158 loc) · 4.37 KB
/
vimrc
File metadata and controls
196 lines (158 loc) · 4.37 KB
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
set nocompatible
"{{{ Syntax Highlighting
set t_Co=256
syntax on
highlight Comment guifg=Blue
highlight SpecialComment guifg=Blue
highlight String ctermfg=Grey
highlight Character ctermfg=Grey
highlight Error ctermfg=none
highlight Constant ctermfg=none
highlight Identifier ctermfg=none
highlight Statement ctermfg=none
highlight PreProc ctermfg=none
highlight Type ctermfg=none
highlight Special ctermfg=none
highlight Underlined ctermfg=none
"}}}
"{{{ Vundle
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'tpope/vim-commentary'
Plugin 'junegunn/goyo.vim'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'romainl/vim-qf'
Plugin 'ajh17/VimCompletesMe'
" Language Plugins
Plugin 'rust-lang/rust.vim'
Plugin 'ARM9/arm-syntax-vim'
call vundle#end()
filetype plugin indent on
"}}}
"{{{ Global Settings
set backspace=indent,eol,start
set autoread
set splitright
set splitbelow
set number
set ruler
set colorcolumn=80
set foldmethod=marker
set backupdir=~/.vim/backup//
set directory=~/.vim/swp//
set undodir=~/.vim/undodir
map q: :q
set tags=./.git/tags;,./tags;
map <C-K> <C-]>
let mapleader = ","
autocmd CompleteDone * pclose
hi clear conceal
set clipboard+=unnamed
set undofile
set incsearch
set ttyfast
"}}}
"{{{ Status Line
set laststatus=2
set statusline=
set statusline+=%F
set statusline+=%m
set statusline+=%r
set statusline+=%h
set statusline+=%w
set statusline+=%=
set statusline+=%{PasteForStatusline()}
set statusline+=[%L]
set statusline+=[%{&ff}]
set statusline+=%y
set statusline+=[%p%%]
set statusline+=[%04l,%04v]
"}}}
"{{{ FZF
nmap ; :Buffers<CR>
nmap <Leader>t :Files<CR>
nmap <Leader>r :Tags<CR>
nmap <Leader>R :silent exec '!ctags -R .' <bar> :Tags<CR>
"}}}
"{{{ Goyo
function! s:goyo_enter()
setl fo-=t
endfunction
function! s:goyo_leave()
setl fo+=t
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
let g:goyo_width = 85
"}}}
"{{{ Custom Commands
command W w !sudo tee % > /dev/null
command Mdcc !pandoc --filter=pandoc-citeproc -f markdown -o %:r.pdf %
nmap <Leader>md :Mdcc<CR>
"https://vi.stackexchange.com/questions/343/how-to-edit-binary-files-with-vim
" Hex read
nmap <Leader>hr :%!xxd<CR> :set filetype=xxd<CR>
" Hex write
nmap <Leader>hw :%!xxd -r<CR> :set binary<CR> :set filetype=<CR>
command -nargs=1 Curl r !curl -s <q-args>
function! PasteForStatusline()
let paste_status = &paste
if paste_status == 1
return "[paste]"
else
return ""
endif
endfunction
" http://learnvimscriptthehardway.stevelosh.com/chapters/07.html
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" Preserve overridden functionaity w/ leader prefix
nnoremap <leader>; ;
nnoremap <leader>, ,
" https://jezenthomas.com/a-function-for-moving-to-the-beginning-of-the-line
" Jump to end of line
noremap L $
" Jump to first character or column
noremap <silent> H :call FirstCharOrFirstCol()<cr>
function! FirstCharOrFirstCol()
let current_col = virtcol('.')
normal ^
let first_char = virtcol('.')
if current_col <= first_char
normal 0
endif
endfunction
"}}}
"{{{ ext --> filetype
au BufRead,BufNewFile *.asm setl filetype=nasm
au BufRead,BufNewFile *.s setl filetype=armv7
au BufRead,BufNewFile *.sql setl filetype=mysql
au BufRead,BufNewFile *.rs setl filetype=rust
au BufRead,BufNewFile *.glsl setl filetype=glsl
au BufRead,BufNewFile *.md setl filetype=markdown
au BufRead,BufNewFile .gitconfig setl filetype=gitconfig
au BufRead,BufNewFile *.ts setl filetype=c
au BufRead,BufNewFile *.log setl filetype=log
"}}}
"{{{ Spacing
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
"}}}
"{{{ Filetype Customizations
autocmd Filetype html,htmldjango setlocal tabstop=2 shiftwidth=2
autocmd Filetype java,sml setlocal tabstop=3 shiftwidth=3
autocmd Filetype hs setlocal tabstop=8 shiftwidth=8
autocmd Filetype make,go setlocal noexpandtab
autocmd Filetype rust compiler cargo
autocmd Filetype vim setl foldcolumn=1
autocmd Filetype text,markdown,tex,plaintex setl spell spelllang=en_us tw=80 fo+=t
autocmd Filetype gitcommit,mail setl spell spelllang=en_us tw=72 fo+=w
autocmd Filetype gitconfig setl noexpandtab
autocmd Filetype log setl colorcolumn= readonly
"}}}