-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvimrc
216 lines (185 loc) · 5.9 KB
/
nvimrc
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
let g:enable_local_swap_dirs=1
let mapleader=","
set background=light
set cindent
set cmdheight=4
set colorcolumn=+1
set expandtab
set foldlevelstart=20
set foldmethod=syntax
set lazyredraw
set mouse=c
set nomodeline
set number relativenumber
set shiftwidth=2
set shortmess=a
set showmatch
set showmode
set softtabstop=2
set tabstop=2
set textwidth=80
set undofile
set wildmode=longest,list
nnoremap <leader>f :e! % <CR>
" Shortcuts to open file with different extension
" TODO: lib <-> test (use separate replace to work within or between dirs).
nnoremap <leader>.d :edit %:p:s,\v(_test)?(\.[^./]*)*$,.dart,<CR>
nnoremap <leader>;d :edit %:p:s,\v(_test)?(\.[^./]*)*$,_test.dart,<CR>
nnoremap <leader>.h :edit %:p:s,\v(_test)?(\.[^./]*)*$,.html,<CR>
nnoremap <leader>;h :edit %:p:s,\v(_test)?(\.[^./]*)*$,_test.html,<CR>
nnoremap <leader>.s :edit %:p:s,\v(_test)?(\.[^./]*)*$,.scss,<CR>
nnoremap <leader>;s :edit %:p:s,\v(_test)?(\.[^./]*)*$,_test.scss,<CR>
nnoremap <leader>.t :edit %:p:s,\v(_test)?(\.[^./]*)*$,.ts,<CR>
nnoremap <leader>;t :edit %:p:s,\v(_test)?(\.[^./]*)*$,_test.ts,<CR>
nnoremap <leader>.x :edit %:p:s,\v(_test)?(\.[^./]*)*$,.tsx,<CR>
nnoremap <leader>;x :edit %:p:s,\v(_test)?(\.[^./]*)*$,_test.tsx,<CR>
nnoremap <leader>p :set invpaste paste?<CR>
nnoremap <leader>s :source ~/.config/nvim/init.vim <CR>
" Tabs
nnoremap <leader>tc :tabnew <CR>
nnoremap <leader>tn :tabnext <CR>
nnoremap <leader>tp :tabprevious <CR>
nnoremap <leader>tq :tabclose <CR>
" Reselect text that was just pasted
nnoremap <leader>v V`]
" Move around, and split, windows
nnoremap <leader>wh <C-w>h
nnoremap <leader>wj <C-w>j
nnoremap <leader>wk <C-w>k
nnoremap <leader>wl <C-w>l
nnoremap <leader>wq <C-w>q
nnoremap <leader>wr <C-w>=
nnoremap <leader>ws <C-w>s<C-w>j
nnoremap <leader>wv <C-w>v<C-w>l
nnoremap <leader>wn :noautocmd w <CR>
nnoremap <leader>ww :w <CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
autocmd BufNewFile,BufRead *.ejs set filetype=html
call plug#begin('~/.local/share/nvim/plugged')
" Stlying
Plug 'altercation/vim-colors-solarized'
let g:solarized_termtrans=1
" Utilities
Plug 'tpope/vim-commentary'
" Tmux
Plug 'christoomey/vim-tmux-navigator'
Plug 'tmux-plugins/vim-tmux'
Plug 'tmux-plugins/vim-tmux-focus-events'
" Terminal
Plug 'kassio/neoterm'
nnoremap <silent> <leader>th :call neoterm#toggle()<cr>
nnoremap <silent> <leader>tx :call neoterm#kill()<cr>
" tt reserved for :Tmap
" Completion manager
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" IMPORTANT: :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
" Completion sources. See https://github.com/ncm2/ncm2/wiki for more.
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
set grepprg=rg\ --vimgrep\ --smart-case
set grepformat=%f:%l:%c:%m,%f:%l:%m
" Fuzzy finder
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
nnoremap <leader>eb :Buffers<CR>
nnoremap <leader>ec :BLines<CR>
nnoremap <leader>ee :Ag<CR>
nnoremap <leader>es :Files<CR>
nnoremap <leader>el :Lines<CR>
nnoremap <leader>ew :Windows<CR>
" Languages
Plug 'dart-lang/dart-vim-plugin'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'udalov/kotlin-vim'
Plug 'phelipetls/vim-hugo'
Plug 'neovim/nvim-lspconfig'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/deoplete-lsp'
let g:deoplete#enable_at_startup = 1
" Always show sign column
autocmd BufEnter * sign define dummy
autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
call plug#end()
colorscheme solarized
" command! -bang FilesCurrent call fzf#run(fzf#wrap({ 'source': 'fd -H . .', 'sink': 'e'}, <bang>0))
" nnoremap <leader>. :FilesCurrent<CR>
" " Plug 'Shougo/echodoc.vim'
" " Plug 'SirVer/ultisnips'
"
" " Plug 'junegunn/vim-peekaboo'
" " Plug 'jlanzarotta/bufexplorer'
" " Plug 'mbbill/undotree'
" " Plug 'natebosch/dartlang-snippets'
" " Plug 'ntpeters/vim-better-whitespace'
" " Plug 'derekwyatt/vim-scala'
" " Plug 'fatih/vim-go'
" " Plug 'tpope/vim-obsession'
" " Plug 'tpope/vim-repeat'
" " Plug 'tpope/vim-speeddating'
" " Plug 'tpope/vim-surround'
" " Plug 'tpope/vim-unimpaired'
" " Plug 'tpope/vim-vinegar'
" " Plug 'xolox/vim-misc'
" " Plug 'xolox/vim-session'
" " Open quickfix at bottom of all windows.
" au FileType qf wincmd J
"
"
" highlight! StatusLine ctermfg=7
" highlight! StatusLineNC ctermfg=7
" highlight! VertSplit ctermfg=7 ctermbg=7
"
" " BufExplorer
" let g:bufExplorerFindActive=0
" let g:bufExplorerShowRelativePath=1
" let g:bufExplorerSortBy='fullpath'
" let g:bufExplorerSplitOutPathName=0
"
" " vim-go
" let g:go_bin_path=expand("~/.vim-go")
"
" " vim-session
" let g:session_autoload='no'
" let g:session_autosave='yes'
" let g:session_autosave_periodic=5
"
" " whitespace
" autocmd BufWritePre * StripWhitespace
"
" " Highlight errors and warnings with red/magenta undercurl
" hi SpellBad term=none ctermbg=none cterm=undercurl ctermfg=Red gui=undercurl guisp=Red
" hi SpellCap term=none ctermbg=none cterm=undercurl ctermfg=Magenta gui=undercurl guisp=Magenta
" General
" Shortcuts
" make regexes very magic
nnoremap / /\v
vnoremap / /\v
" " or use keymaps that works with text-objects
" " nmap gx <Plug>(neoterm-repl-send)
" " xmap gx <Plug>(neoterm-repl-send)
" " nmap gxx <Plug>(neoterm-repl-send-line)
" " now can use gx{text-objects} such as gxip
"
" nnoremap <leader>bn :bNext<CR>
" nnoremap <leader>bp :bPrevious<CR>
" nnoremap <leader>bs :BufExplorerHorizontalSplit<CR>
" nnoremap <leader>bv :BufExplorerVerticalSplit<CR>
" nnoremap <leader>bx :BufExplorer<CR>
"
" nnoremap <leader>d :YcmCompleter GoToDefinition<CR>
"
" Trim trailing whitespace
nnoremap <leader>tw :%s/\s\+$//e<CR>
"
" " Toggle undo-tree panel
" nnoremap <leader>u :UndotreeToggle<cr>