-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
152 lines (116 loc) · 3.54 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
filetype off
if has('gui_running')
set background=light
else
set background=dark
endif
set updatetime=250
let g:pathogen_disabled = []
" Comment the following line out on systems with ROS installed
call add(g:pathogen_disabled,'syntastic')
call add(g:pathogen_disabled,'vim-ros')
call add(g:pathogen_disabled,'ctrlp')
call add(g:pathogen_disabled,'lusty')
set t_Co=256
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
execute pathogen#infect()
filetype plugin indent on
set expandtab
set tabstop=4
set shiftwidth=4
set hidden " Allow unsaved buffers
let g:LustyExplorerSuppressRubyWarning = 1
map Y y$
syntax enable
colorscheme solarized
set tabstop=2
set shiftwidth=2
set expandtab
let mapleader = ","
nnoremap <leader>o :only<CR>
" LSP
nnoremap <leader>D :LspDefinition<CR>
" Kill trailing whitespace with ,W
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Tab Navigation
nnoremap <leader>h :tabp<CR>
nnoremap <leader>l :tabn<CR>
nnoremap H :tabp<CR>
nnoremap L :tabn<CR>
" Set paste
nnoremap <leader>p :set paste<CR>o
"NERDTree
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>f :NERDTreeFind<CR>
nnoremap <leader>t :TlistToggle<CR>
"Buffers and Files
nnoremap <leader>B :Buffers<CR>
nnoremap <leader>F :Files<CR>
" Pane Navigation
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>
set splitbelow
set splitright
" Keep selection after shifts
vnoremap < <gv
vnoremap > >gv
" Enable XML folding
let g:xml_syntax_folding=1
au FileType xml setlocal foldmethod=syntax
au BufNewFile,BufRead *.nfo set filetype=nfo
" We'll make our table_mode table reST compatible
let g:table_mode_corner_corner="+"
let g:table_mode_header_fillchar="="
" Configure CTRL-P Plugin
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" LSP
if executable('clangd-mp-6.0')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd-mp-6.0']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cxx', 'h', 'hpp', 'hxx'],
\ })
endif
if executable('pyls')
" pip install python-language-server
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'],
\ })
endif
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_rust_checkers = ['cargo']
set encoding=utf8
" Taglist
let g:Tlist_Use_Horiz_Window=1
" Configure FSwitch
au! BufEnter *.cpp let b:fswitchdst = 'hpp,h,hxx'
au! BufEnter *.cc let b:fswitchdst = 'hpp,h,hxx' | let b:fswitchlocs = './'
au! BufEnter *.cxx let b:fswitchdst = 'hpp,h,hxx' | let b:fswitchlocs = './'
au! BufEnter *.h let b:fswitchdst = 'cpp,cxx,cc,c' | let b:fswitchlocs = './'
au! BufEnter *.hpp let b:fswitchdst = 'cpp,cxx,cc,c' | let b:fswitchlocs = './'
au! BufEnter *.hxx let b:fswitchdst = 'cpp,cxx,cc,c' | let b:fswitchlocs = './'
nnoremap <leader>s :FSHere<CR>
" Show Trailing Whitespace
highlight ShowTrailingWhitespace ctermbg=Red guibg=Red
set rtp+=$HOME/.fzf
" Add a Rg command to fzf.vim
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)