-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
236 lines (195 loc) · 6.35 KB
/
init.vim
File metadata and controls
236 lines (195 loc) · 6.35 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
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
233
234
235
236
set nocompatible
let mapleader = ";"
let g:python2_host_prog = '/usr/local/Cellar/python@2/2.7.15_1/bin/python'
let g:python3_host_prog = '/usr/local/Cellar/python@3.9/3.9.6/bin/python3'
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" ----- Plugins -----
call plug#begin('~/.local/share/nvim/plugged')
Plug 'junegunn/vim-easy-align' "Easy alignment of text
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround' " Surround text
Plug 'tpope/vim-commentary' "Comment code easily
" Visual
Plug 'Lokaltog/vim-distinguished' "distinguished color scheme
Plug 'vim-airline/vim-airline' "airline
Plug 'bling/vim-bufferline' "Shows buffers on airline
Plug 'vim-airline/vim-airline-themes' "Themes for airline
Plug 'scrooloose/nerdtree' "Gives you proper file tree when called :NERDTre
Plug 'scrooloose/nerdtree-git-plugin' "Shows git status on NerdTree
Plug 'junegunn/fzf.vim' "Fuzzy Search
" AutoComplete
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/echodoc.vim'
" Plug 'liuchengxu/vista.vim' " Tagbar for LSP
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries' } "Go Plugin
Plug 'rust-lang/rust.vim' "Rust Plugin
Plug 'psf/black', {'branch': 'stable' } "Python Formatting
Plug 'Vimjas/vim-python-pep8-indent' " Python indentation
Plug 'alx741/vim-hindent' "Haskell Formatting
Plug 'hashivim/vim-terraform' " Terraform formatting
Plug 'cespare/vim-toml' " Toml formatting
" Add maktaba and codefmt to the runtimepath.
" (The latter must be installed before it can be used.)
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
" Also add Glaive, which is used to configure codefmt's maktaba flags. See
" `:help :Glaive` for usage.
Plug 'google/vim-glaive'
" Writing
Plug 'vimwiki/vimwiki' "Vim wiki
Plug 'junegunn/goyo.vim' "Distraction free writing
Plug 'junegunn/limelight.vim' "Highlights current line
" Tmux Integration
Plug 'christoomey/vim-tmux-navigator' "navigate tmux/vim splits easily
call plug#end()
" ----- Tabs/Spacing -----
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
set autoindent
set textwidth=80
set fileformat=unix
set backspace=indent,eol,start
" ----- UI -----
filetype plugin indent on
syntax on
set lazyredraw
set hidden
set updatetime=500
set relativenumber
set number
set showcmd
" set cursorline
set showmatch
set wildmenu
set cmdheight=2
" Make vim resize when host is resized
:autocmd VimResized * wincmd =
" ----- Splits -----
set splitbelow
set splitright
"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>
" ----- Copying -----
set clipboard=unnamed
set pastetoggle=<F2>
" ----- Searching -----
set ignorecase
set incsearch
set hlsearch
" nmap <silent> ,/ :nohlsearch<CR>
" ----- Folding -----
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" ----- Brackets -----
inoremap {<cr> {<cr>}<c-o>O
inoremap [<cr> [<cr>]<c-o>O<tab>
inoremap (<cr> (<cr>)<c-o>O
" ----- Keybindings -----
nnoremap <leader>t :NERDTreeToggle<CR>
nnoremap <leader>f :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>d :bd<CR>
nnoremap <leader>s :w<CR>
nnoremap <leader>l :nohlsearch<CR>
nnoremap <C-C> <C-A>
" ----- Last Position -----
function! PositionCursonFromViminfo()
if !(bufname("%") =~ '\(COMMIT_EDITMSG\)') && line("'\"") > 1 && line("'\"") <= line("$")
exe "normal! g`\""
endif
endfunction
au BufReadPost * call PositionCursonFromViminfo()
" ----- Colors -----
let g:solarized_termcolors=256 "needed for solarzied
syntax on
syntax enable
colorscheme distinguished "Color scheme
set background=dark
" ----- File Types -----
" Git Commits
au FileType gitcommit set tw=72
" Makefiles
autocmd BufEnter ?makefile* set include^s\=include
autocmd BufLeave ?makefile* set include&
" Markdown
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
" ----- Airline -----
set laststatus=2
set ttimeoutlen=50
let g:airline#extensions#branch#enabled=1
" ----- Language Client -----
let g:LanguageClient_serverCommands = {
\ 'go': ['gopls'],
\ 'rust': ['rls'],
\ 'python': ['/usr/local/bin/pyls'],
\ 'haskell': ['hie-wrapper', '--lsp'],
\ }
nnoremap <leader>r :call LanguageClient_contextMenu()<CR>
" ----- Deoplete -----
let g:deoplete#enable_at_startup = 1
imap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
imap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<tab>"
imap <expr> <cr> pumvisible() ? deoplete#close_popup() : "\<cr>"
inoremap <silent><expr><C-Space> deoplete#mappings#manual_complete()
" let g:deoplete#enable_camel_case = 1
" set completeopt+=noinsert
" set completeopt+=noselect
" set completeopt-=preview
" ----- Echodoc -----
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature'
" ----- Vista -----
let g:vista_executive_for = {
\ 'go': 'lcn',
\ }
nnoremap <leader>v :Vista!!<CR>
" ----- Vim-Go -----
let g:go_fmt_command = "goimports"
let g:go_def_mode='gopls'
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
" ----- Rust -----
let g:rustfmt_autosave = 1
" ----- Black -----
autocmd BufWritePre *.py execute ':Black'
" ----- codefmt -----
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType proto AutoFormatBuffer clang-format
augroup END
" ----- Vim Wiki -----
let wiki_1 = {}
let wiki_1.path = '~/vimwiki_personal/'
let wiki_1.syntax = 'markdown'
let wiki_1.ext = '.md'
let g:vimwiki_list = [wiki_1]
" let g:vimwiki_ext2syntax = {'.md':'markdown', '.markdown':'markdown', 'mdown':'markdown'}
" ----- fzf -----
set rtp+=/usr/local/opt/fzf
let g:fzf_layout = { 'down': '40%' }
" ----- Easy Align -----
xmap ga <Plug>(EasyAlign)