-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
196 lines (166 loc) · 4.79 KB
/
init.vim
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
" General Settings
inoremap jk <esc>
inoremap <esc> <nop>
" leader key stuff
let mapleader=","
let maplocalleader="\\"
nnoremap <leader>ev :vsp $MYVIMRC<CR>
nnoremap <leader>ez :vsp ~/.zshrc<CR>
nnoremap <leader>sv :source $MYVIMRC<CR>
" interface
set colorcolumn=81
set cursorline
set laststatus=2
set noshowmode
set number
set ruler
set showcmd
set sidescroll=1
" base
filetype plugin indent on
syntax on
set wildmenu
" Remap C-w-h/C-w-j/C-w-k/C-w-l to C-h/C-j/C-k/C-l
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-l> :wincmd l<CR>
" Share clipboard between multiple vim sessions
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada
" Search for text selected in visual mode
vnoremap // y/<C-R>"<CR>
set splitbelow
set splitright
" toggle relative numbering
function! NumberToggle()
if(&relativenumber == 1)
set number
set nornu
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
" whitespace
set expandtab
set nojoinspaces
set shiftwidth=2
set softtabstop=2
set tabstop=2
" searching
set hlsearch
set ignorecase
set incsearch
set smartcase
nnoremap <leader><space> :nohlsearch<CR>
" folding
set foldenable
set foldlevelstart=10
set foldnestmax=10
set foldmethod=indent
nnoremap <space> za
" background processes
set autoread
set autoindent
set clipboard=unnamed
set lazyredraw
set noswapfile
set nofsync
set ttyfast
" movement
nnoremap j gj
nnoremap k gk
nnoremap B ^
nnoremap E $
nnoremap ^ <nop>
nnoremap $ <nop>
" Plugins
call plug#begin('~/.local/share/nvim/plugged')
" syntax related
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'sebastianmarkow/deoplete-rust'
Plug 'alvan/vim-closetag'
Plug 'bronson/vim-trailing-whitespace'
Plug 'jiangmiao/auto-pairs'
Plug 'matze/vim-move'
Plug 'sheerun/vim-polyglot'
Plug 'valloric/matchtagalways'
Plug 'tpope/vim-sleuth'
Plug 'tmux-plugins/vim-tmux'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'jelera/vim-javascript-syntax'
Plug 'xolox/vim-misc'
Plug 'majutsushi/tagbar'
Plug 'lervag/vimtex'
" ui related
Plug 'airblade/vim-gitgutter'
Plug 'dietsche/vim-lastplace'
Plug 'morhetz/gruvbox'
Plug 'yggdroot/indentline'
Plug 'christoomey/vim-tmux-navigator'
Plug 'scrooloose/nerdtree'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'mhinz/vim-startify'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'edkolev/tmuxline.vim'
" background related
Plug 'w0rp/ale'
Plug 'craigemery/vim-autotag'
Plug 'mileszs/ack.vim'
" other
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'easymotion/vim-easymotion'
Plug 'ctrlpvim/ctrlp.vim'
call plug#end()
" Plugin settings
" airline
let g:airline_powerline_fonts = 1
" close-tag
let g:closetag_filenames = "*.html,*.jsx"
" deoplete
let g:deoplete#enable_at_startup = 1
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" deoplete-rust
let g:deoplete#sources#rust#racer_binary='~/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src'
" gitgutter
let g:gitgutter_sign_column_always = 1
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 = '~_'
"vim-js-pretty-tempalte
autocmd FileType typescript JsPreTmpl html
autocmd FileType typescript syn clear foldBraces
autocmd FileType rust let g:ale_lint_on_text_changed = 0
autocmd FileType rust let g:ale_lint_on_save = 1
" Nerdtree
map <C-i> :NERDTreeToggle<CR>
" matchtagalways
let g:mta_filetypes = {
\ 'javascript.jsx': 1,
\ 'html' : 1,
\ 'xml' : 1,
\ }
" polyglot
let g:polyglot_disabled = ['latex']
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
let g:ctrlp_cmd = 'CtrlP'
" theme settings
let g:gruvbox_italic=1
let g:gruvbox_contrast_dark='hard'
set background=dark
colorscheme gruvbox
" ale
let g:ale_linters = { 'javascript': ['eslint'] }
" tern
autocmd FileType javascript nnoremap <silent> <buffer> gb :TernDef<CR>
set conceallevel=0