-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
180 lines (144 loc) · 3.93 KB
/
vimrc
File metadata and controls
180 lines (144 loc) · 3.93 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
" vim settings
"
" <leader> -> \
" <C> -> Control
" j: down
" k: up
" h: left
" l: right
" for buggy terminal
set guicursor=
" Stop certain movements from always going to the first character of a line.
set nostartofline
" Set encoding
set encoding=utf-8
" whitespaces
set expandtab
set tabstop=4
set shiftwidth=4
" set title of terminal
set title
" make sure number in gutter is not copied
set mouse=a
" Split: behavior and shortcut
" reszie +5 / vertical resize -
" ctrl-w = (vertical)
" ctrl-w | (max width)
" ctrl-w _ (max height)
" ctrl-w R (swap)
" ctrl-w T (move to tab)
" ctrl-w o (close all window but current)
set splitbelow
set splitright
" navigations, down (j), up (k), right (l), left (h)
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>
" Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
" Delete trailing whitespaces
" https://vim.fandom.com/wiki/Remove_unwanted_spaces
nnoremap <silent> <F5> :let _s=@/ <Bar> :%s/\s\+$//e <Bar> :let @/=_s <Bar> :nohl <Bar> :unlet _s <CR>
if has("nvim")
" == neovim only ==
" NeoVim Term: map <Esc> to exit terminal-mode
tnoremap <Esc> <C-\><C-n>
else
" == vim only ==
" Prevent Vim from clobbering the scrollback buffer. See
" http://www.shallowsky.com/linux/noaltscreen.html
set t_ti= t_te=
au VimLeave * :!clear
endif
" live substitute: neovim only
if exists('&inccommand')
set inccommand=split
endif
" == vim plugins ==
" Plug: install vim-plug if not found
if has('nvim')
let g:vim_plug_install_path = '~/.config/nvim/autoload/plug.vim'
else
let g:vim_plug_install_path = '~/.vim/autoload/plug.vim'
endif
if empty(glob(vim_plug_install_path))
let g:vim_plug_github = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
execute "silent !curl -fLo " . g:vim_plug_install_path . " " . g:vim_plug_github " --create-dirs"
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
if has('nvim')
let g:vim_plug_dir = '~/.local/share/nvim/plugged'
else
let g:vim_plug_dir = '~/.vim/plugged'
endif
" Plug: vim plugins, use single quote
call plug#begin(vim_plug_dir)
" general settings
Plug 'tpope/vim-sensible'
" colorscheme
Plug 'sheerun/vim-polyglot'
Plug 'robertmeta/nofrils'
Plug 'arzg/vim-corvine'
Plug 'dracula/vim'
" status
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" git
Plug 'tpope/vim-fugitive'
" gutter
Plug 'airblade/vim-gitgutter'
Plug 'myusuf3/numbers.vim'
" code search and navigation
Plug 'haya14busa/incsearch.vim'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'majutsushi/tagbar'
" file search and navgigation
Plug 'scrooloose/nerdtree'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/fzf', { 'dir': '~/.local/share/fzf', 'do': './install --all' }
" python
if executable("black") && has("python3")
Plug 'psf/black'
endif
if has("nvim") && has("python3")
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'deoplete-plugins/deoplete-clang'
Plug 'deoplete-plugins/deoplete-go'
Plug 'deoplete-plugins/deoplete-make'
Plug 'deoplete-plugins/deoplete-terminal'
Plug 'deoplete-plugins/deoplete-zsh'
Plug 'deoplete-plugins/deoplete-docker'
Plug 'deoplete-plugins/deoplete-tag'
endif
call plug#end()
" colorschemes
silent! colorscheme dracula
" python 3 only
let g:python3_host_prog='python3'
let g:loaded_python_provider = 0
let g:python_host_prog = ''
" airline-themes
let g:airline_theme='minimalist'
" TagBar:
nmap <Leader>rt :TagbarToggle<CR>
" NERDTree:
map <C-n> :NERDTreeToggle<CR>
" Deoplete
" Enable deoplete when InsertEnter.
if has("python3")
let g:deoplete#enable_at_startup = 0
autocmd InsertEnter * call deoplete#enable()
endif
" Vimux
" Prompt for a command to run
map <Leader>vp :VimuxPromptCommand<CR>