-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.vim
More file actions
196 lines (176 loc) · 5.52 KB
/
Copy pathinit.vim
File metadata and controls
196 lines (176 loc) · 5.52 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
if &compatible
set nocompatible " Be iMproved
endif
" setup plugins directory for vim-plug
call plug#begin('~/.vim_plugins')
Plug 'dracula/vim'
Plug 'fatih/vim-go', { 'for': 'go' }
" Plug 'Shougo/deoplete.nvim'
" Plug 'zchee/deoplete-go', {'build': 'make'}
Plug 'majutsushi/tagbar'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'mhinz/vim-startify'
Plug 'airblade/vim-gitgutter'
Plug 'itchyny/vim-gitbranch'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'ekalinin/Dockerfile.vim'
Plug 'vim-syntastic/syntastic'
Plug 'Shougo/unite.vim'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-dispatch'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-fugitive'
Plug 'saltstack/salt-vim'
Plug 'python-mode/python-mode'
Plug 'Valloric/YouCompleteMe'
" Initialize plugin system
call plug#end()
" Configuration
" set working directory automatically to the current open file
set autochdir
" set theme
color dracula
" no beeping
set noerrorbells
" ignore case while searching
set ignorecase
" ignore case unless query have case set
set smartcase
" set relative line numbers
set relativenumber
" show the actual line number where you are at
set number
set cursorline
" vim-go syntax highlighting
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" gometalinter
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
" run gometalinter on save
let g:go_metalinter_autosave = 1
" let gometalinter timeout if it takes to long
let g:go_metalinter_deadline = "5s"
" use goimports with vim-go instead of gofmt
let g:go_fmt_command = "goimports"
" show GoInfo automatically
let g:go_auto_type_info = 1
" auto show Go code identifiers
let g:go_auto_sameids = 1
" python configuration
let g:python_host_prog = '/usr/bin/python'
" python formatting
autocmd FileType python nnoremap <leader>y :0,$!yapf<Cr>
" To close preview window of deoplete automagically
autocmd CompleteDone * pclose
" airline configuration
" let g:airline#extensions#tabline#enabled = 2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#right_sep = ' '
let g:airline#extensions#tabline#right_alt_sep = '|'
let g:airline_left_sep = ' '
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|'
let g:airline_theme= 'dracula'
" vim-gutter configuration
let g:gitgutter_override_sign_column_highlight = 0
highlight SignColumn ctermbg=black
" markdown configuration
" disabled automatic folding
let g:vim_markdown_folding_disabled=1
" syntastic configuration
" make it play nice with vim-go
let g:syntastic_go_checkers = ['gometalinter','golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_list_type = "quickfix"
" give salt .sls files yaml syntax highlighting
au BufNewFile,BufRead *.sls setlocal ft=yaml
" treate terraform files as yaml
au BufNewFile,BufRead *.tf setlocal ft=yaml
" set indentation to 2 spaces for yaml
autocmd Filetype yaml setlocal ts=2 sw=2 expandtab
" set working directory per tab
" https://dmerej.info/blog/post/vim-cwd-and-neovim/
function! OnTabEnter(path)
if isdirectory(a:path)
let dirname = a:path
else
let dirname = fnamemodify(a:path, ":h")
endif
execute "tcd ". dirname
endfunction()
autocmd TabNewEntered * call OnTabEnter(expand("<amatch>"))
" Key bindings
" get to commands faster
nnoremap ; :
" leader key
let mapleader = "\<SPACE>"
" show tagbar
nmap <leader>t :TagbarToggle<CR>
" vim-commentry
noremap <leader>; :Commentary<cr>
" fzf settings
" show files
nnoremap <silent> <leader><space> :Files<CR>
" show buffers
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>w :Windows<CR>
" interactive search of the current file/buffer
nnoremap <silent> <leader>l :BLines<CR>
nnoremap <silent> <leader>o :BTags<CR>
nnoremap <silent> <leader>O :Tags<CR>
" show MRU files
nnoremap <silent> <leader>? :History<CR>
" search lines through files
nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR>
" git fugitive key bindings
" show git commits
nnoremap <silent> <leader>gl :Commits<CR>
nnoremap <silent> <leader>ga :BCommits<CR>
" git status
nnoremap <silent> <leader>gs :Gstatus<CR>
" git diff
nnoremap <silent> <leader>gd :Gdiff<CR>
" git commit
nnoremap <silent> <leader>gc :Gcommit<CR>
" git push
nnoremap <silent> <leader>gps :Dispatch! git push<CR>
" git pull
nnoremap <silent> <leader>gpl :Dispatch git pull<CR>
" git blame
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>ge :Gedit<CR>
nnoremap <silent> <leader>gE :Gedit<space>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gR :Gread<space>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>gW :Gwrite!<CR>
nnoremap <silent> <leader>gq :Gwq<CR>
nnoremap <silent> <leader>gQ :Gwq!<CR>
" set escape key to terminal insert exit
tnoremap <Esc> <C-\><C-n>
" set the working dir to the current open file
nnoremap ,cd :cd %:p:h<CR>:pwd<CR>
" new empty tab
nnoremap <silent> <leader>\ :tabnew<CR>
" next tab
nnoremap <silent> <leader>] :tabnext<CR>
" previous tab
nnoremap <silent> <leader>[ :tabnext<CR>
" map window splitting
" horizontal
nnoremap <silent> <leader>- :sp<CR>
" vertical
nnoremap <silent> <leader>= :vsplit<CR>
" test ne key bindings