-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
180 lines (152 loc) Β· 5.1 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
set nocompatible "not compatible with vi
filetype off "required
call plug#begin('~/.config/nvim/autoload/plug.vim')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-fugitive'
Plug 'ryanoasis/vim-devicons'
Plug 'myusuf3/numbers.vim'
Plug 'tmhedberg/SimpylFold'
Plug 'scrooloose/syntastic'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/fzf.vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
Plug 'rhysd/vim-grammarous'
Plug 'tomasr/molokai'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
let mapleader=","
filetype plugin indent on "detect file types
let python_highlight_all=1
syntax on "add syntax highlighting
colorscheme molokai
let g:molokai_original = 1
set number "turn on line numbers
set encoding=utf-8
set cursorline "easy to see what line your on
set rtp+=~/.fzf
" This is all about code folding
set foldmethod=indent "enable folding
set foldlevel=99
nnoremap <space> za
let g:SimpylFold_docstring_preview=1
"Use deoplete
let g:deoplete#enable_at_startup = 1
" Cool fonts
let g:airline_powerline_fonts=1
set backspace=indent,eol,start
set autowrite
" arrow keys disable
nnoremap <right> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <up> <nop>
vnoremap <right> <nop>
vnoremap <down> <nop>
vnoremap <left> <nop>
vnoremap <up> <nop>
" NERDTree
" Open NERDTree as I open vim
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Close NERDTree if its last buffer
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Allow NERDTree delete buffers
let NERDTreeAutoDeleteBuffer = 1
" Open NERDTree in the directory of the current file (or /home if no file is open)
function! NERDTreeToggleFind()
" if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1)
" execute ":NERDTreeClose"
" else
execute ":NERDTreeFind"
" endif
endfunction
nnoremap <leader>c :call NERDTreeToggleFind()<cr>
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "βΉ",
\ "Staged" : "β",
\ "Untracked" : "β",
\ "Renamed" : "β",
\ "Unmerged" : "β",
\ "Deleted" : "β",
\ "Dirty" : "β",
\ "Clean" : "βοΈ",
\ 'Ignored' : 'β',
\ "Unknown" : "?"
\ }
" go stuff
autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap <leader>t <Plug>(go-test)
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
"let g:go_fmt_command = "goimports"
"function! Imp()
" execute "!"."go fmt"." ".bufname("%").">/dev/null 2>&1" | redraw!
"endfunction
"augroup dom
" au!
" au BufWrite *.go silent! :call Imp()
"augroup END
" Language Server
set hidden
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" Launch gopls when Go files are in use
let g:LanguageClient_serverCommands = {
\ 'go': ['gopls'],
\ 'python': ['/home/dominic/.local/bin/pyls']
\ }
" Run gofmt and goimports on save
autocmd BufWrite *.go :call LanguageClient#textDocument_formatting_sync()
function SetLSPShortcuts()
nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
nnoremap <leader>lt :call LanguageClient#textDocument_typeDefinition()<CR>
nnoremap <leader>lx :call LanguageClient#textDocument_references()<CR>
nnoremap <leader>la :call LanguageClient_workspace_applyEdit()<CR>
nnoremap <leader>lc :call LanguageClient#textDocument_completion()<CR>
nnoremap <leader>lh :call LanguageClient#textDocument_hover()<CR>
nnoremap <leader>ls :call LanguageClient_textDocument_documentSymbol()<CR>
nnoremap <leader>lm :call LanguageClient_contextMenu()<CR>
endfunction()
augroup LSP
autocmd!
autocmd FileType go,python call SetLSPShortcuts()
augroup END
" move between buffers
noremap <silent>]b :bnext<CR>
noremap <silent>[b :bprevious<CR>
" move between panes
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" FZF nicer search
nnoremap <leader>p :Files<CR>
nnoremap <C-n> :Buffers<CR>
" Preview files when calling File.
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
nnoremap <leader>p :Files!<CR>
" Like File, but with PWD.
nnoremap <leader>P :call fzf#vim#files(expand("%:p:h"), fzf#vim#with_preview(), 1)<CR>
" highligh in markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'go', 'java']
" Org mode
let g:org_agenda_files = ['~/org/index.org']