-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
168 lines (126 loc) · 4.76 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
set nocompatible
set hidden
call plug#begin('~/.vim/plugged')
Plug 'git://github.com/lifepillar/vim-solarized8'
Plug 'git://github.com/vim-airline/vim-airline'
Plug 'git://github.com/vim-airline/vim-airline-themes'
Plug 'git://github.com/airblade/vim-gitgutter'
Plug 'git://github.com/kien/ctrlp.vim'
Plug 'git://github.com/mhinz/vim-grepper'
Plug 'git://github.com/scrooloose/nerdtree'
Plug 'git://github.com/thinca/vim-visualstar'
Plug 'git://github.com/kshenoy/vim-signature'
Plug 'https://github.com/tpope/vim-surround'
Plug 'liuchengxu/vim-which-key'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
call plug#end()
set encoding=utf-8
set termencoding=utf-8
" terminal color hack
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
syntax on
set background=dark
colorscheme solarized8_flat
set directory=~/.vim/swapfiles//
set nowrap " disable visual line breaking
set linebreak " enable physical line breaking
set textwidth=100 " break lines over 100 characters long
set backspace=2 " make backspace work over line breaks and for text that wasn't written
" during this "insert" session.
set tabstop=4
set shiftwidth=4 " 1 tab = 4 columns
set expandtab " soft tabs (spaces instead)
set softtabstop=4 " delete whole "tab" of 4 spaces
set autoindent " keep indentation when breaking lines
set noshowmode " don't show the -- INSERT -- text
set laststatus=2 " always show the status bar
set ttymouse=sgr
set mouse=a " scroll in vim, not history
set ttimeoutlen=10 " reduce delay when leaving INSERT mode
set showmatch " show matching [{( )}]
set hlsearch " highlight search matches
set incsearch " search while typing
set ignorecase " need to have this to enable smartcase
set smartcase " ignore case for fully-lowercase searches
set number " show line numbers
set cursorline " highlight the current line number
hi CursorLine term=none cterm=none gui=none ctermbg=none
" make vertical split bar less intrusive
" NB. whitespace after \ significant
:set fillchars+=vert:\
" Vim-Airline settings
let g:airline_theme='solarized'
let g:airline_solarized_bg='dark'
let g:airline_solarized_dark_inactive_border=1
" do not echo to command bar
let g:bufferline_echo = 0
let mapleader="\<SPACE>"
" Close buffer but keep split window open
nmap ,d :b#<bar>bd#<bar>b<CR>
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
nnoremap <Leader>wh <c-w>h
nnoremap <Leader>wj <c-w>j
nnoremap <Leader>wk <c-w>k
nnoremap <Leader>wl <c-w>l
let g:gitgutter_sign_added = '· '
let g:gitgutter_sign_modified = '· '
let g:gitgutter_sign_removed = '· '
let g:gitgutter_sign_removed_first_line = '· '
let g:gitgutter_sign_modified_removed = '· '
let g:ctrlp_working_path_mode = 'ra'
" Make ctrlp ignore files from gitignore
" From https://github.com/kien/ctrlp.vim/issues/174
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" shortcuts for CtrlP
nnoremap <Leader>ff :CtrlP<CR>
nnoremap <Leader>fb :CtrlPBuffer<CR>
nnoremap <Leader>fm :CtrlPMRU<CR>
nnoremap <Leader>ft :CtrlPTag<CR>
" tag shortcuts
nnoremap <Leader>tn :tnext<CR>
nnoremap <Leader>tp :tprev<CR>
" for vim-grepper
nnoremap <Leader>gf :Grepper<Space>-query<Space>
nnoremap <Leader>gb :Grepper<Space>-buffers<Space>-query<Space>
vnoremap <Leader>gf y:Grepper<Space>-query<Space><C-r>"
vnoremap <Leader>gb y:Grepper<Space>-buffers<Space>-query<Space><C-r>"
" NERDTree
nnoremap <Leader>nn :NERDTreeToggle<CR>
nnoremap <Leader>nf :NERDTreeFind<CR>
" GitGutter
nnoremap <Leader>hn :GitGutterNextHunk<CR>
nnoremap <silent> <leader> :WhichKey '<Space>'<CR>
set timeoutlen=500
" Autocomplete
let g:asyncomplete_smart_completion = 1
let g:asyncomplete_auto_popup = 1
"autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
nnoremap <Leader>sd :LspDefinition<CR>
nnoremap <Leader>ss :LspDocumentSymbol<CR>
nnoremap <Leader>si :LspHover<CR>
nnoremap <Leader>sr :LspRename<CR>
let g:minimap_toggle='<Leader>mm'
set cot-=preview
if executable('clangd')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
if executable('pyls')
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'],
\ })
endif