Skip to content

Commit f7e4941

Browse files
author
Alex (Osleg) Zaslavsky
committed
lua version
1 parent 4fec512 commit f7e4941

File tree

11 files changed

+1166
-800
lines changed

11 files changed

+1166
-800
lines changed

bindings/bindings.vim

Lines changed: 25 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
" vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker nospell:
22

3-
so ~/.config/nvim/bindings/whichkey.vim
43
" Vim {{{
54
" Disable EX mode
65
nnoremap Q <nop>
@@ -44,22 +43,19 @@ so ~/.config/nvim/bindings/whichkey.vim
4443
" Write the file with sudo
4544
cmap w!! w !sudo tee % > /dev/null
4645
" NVim Terminal emulator mappings {{{
47-
if has('nvim')
48-
fun! Fterm_maps()
49-
if &ft =~ 'fzf'
50-
return
51-
endif
52-
tnoremap <buffer><Esc> <C-\><C-n>
53-
tnoremap <buffer><C-h> <C-\><C-n><C-w>h
54-
tnoremap <buffer><C-j> <C-\><C-n><C-w>j
55-
tnoremap <buffer><C-k> <C-\><C-n><C-w>k
56-
tnoremap <buffer><C-l> <C-\><C-n><C-w>l
57-
endf
58-
augroup term_maps
59-
" this one is which you're most likely to use?
60-
autocmd BufEnter * call Fterm_maps()
61-
augroup end
62-
endif
46+
fun! Fterm_maps()
47+
if &ft =~ 'fzf'
48+
return
49+
endif
50+
tnoremap <buffer><Esc> <C-\><C-n>
51+
tnoremap <buffer><C-h> <C-\><C-n><C-w>h
52+
tnoremap <buffer><C-j> <C-\><C-n><C-w>j
53+
tnoremap <buffer><C-k> <C-\><C-n><C-w>k
54+
tnoremap <buffer><C-l> <C-\><C-n><C-w>l
55+
endf
56+
augroup term_maps
57+
autocmd BufEnter * call Fterm_maps()
58+
augroup end
6359
" }}}
6460
" Fast buffer switching {{{
6561
map <S-H> :bp<CR>
@@ -71,176 +67,26 @@ so ~/.config/nvim/bindings/whichkey.vim
7167
nnoremap <C-L> <C-W>l
7268
nnoremap <C-H> <C-W>h
7369
" }}}
74-
" Toggle loclist
75-
nmap <silent> <leader>bql :call ToggleList("Location List", 'l')<CR>
76-
" Toggle qfix
77-
nmap <silent> <leader>bqq :call ToggleList("Quickfix List", 'c')<CR>
7870
" Adjust splits evenly
7971
map <Leader>= <C-w>=
8072
" Toggle Linebreaks and wraps
81-
nnoremap <silent><Leader>bvl :set wrap!<CR> \| :set linebreak!<CR>
73+
nnoremap <silent><Leader> :set wrap!<CR> \| :set linebreak!<CR>
8274
" Clear search term (and it hilight :) )
8375
nmap <silent><Leader>/ :let @/=""<CR>
84-
" Fast access to vim settings
85-
nnoremap <silent> <leader>fevc :vsplit ~/.config/nvim/init.vim<CR>
86-
nnoremap <silent> <leader>fevb :vsplit ~/.config/nvim/bindings.vim<CR>
87-
nnoremap <silent> <leader>fevp :vsplit ~/.config/nvim/plugins/plug.nvim<CR>
8876
" Add modeline to file
89-
nnoremap <silent> <Leader>fm :call AppendModeline()<CR>
77+
nnoremap <silent> <Leader>am :call AppendModeline()<CR>
9078
" Fast splits
91-
nnoremap <silent> <leader>bsv :vsplit<CR>
92-
nnoremap <silent> <leader>bsh :split<CR>
79+
nnoremap <silent> <leader>sv :vsplit<CR>
80+
nnoremap <silent> <leader>sh :split<CR>
9381
" }}}
94-
" Plugins {{{
95-
" Which Key {{{
96-
nnoremap <silent><leader> :WhichKey '<Space>'<CR>
97-
nnoremap <silent><localleader> :WhichKey '\'<CR>
98-
" }}}
99-
" Buffers {{{
100-
" NERDTree {{{
101-
nnoremap <silent><Leader>be :NERDTreeFocus<CR>
102-
" }}}
103-
" Tagbar {{{
104-
nnoremap <silent><Leader>bT :TagbarOpen fjc<CR>
105-
" }}}
106-
" BBye {{{
107-
nnoremap <silent> <leader>bd :Bdelete<CR>
108-
" }}}
109-
" FZF {{{
110-
nmap <leader><tab> <Plug>(fzf-maps-n)
111-
imap <leader><tab> <Plug>(fzf-maps-i)
112-
xmap <leader><tab> <Plug>(fzf-maps-x)
113-
nnoremap <Leader>bf :GFiles<CR>
114-
nnoremap <Leader>bF :Files<CR>
115-
nnoremap <Leader>bb :Buffers<CR>
116-
" fast buffers access
117-
nnoremap <Leader><Space> :Buffers<CR>
118-
nnoremap <Leader>bb :Buffers<CR>
119-
nnoremap <Leader>bg :Rg
120-
nnoremap <Leader>bl :BLines<CR>
121-
nnoremap <Leader>bL :Lines<CR>
122-
nnoremap <Leader>bt :BTags<CR>
123-
nnoremap <Leader>bc :Commands<CR>
124-
nnoremap <Leader>bp :Commits<CR>
125-
" }}}
126-
" Sessionman {{{
127-
" Open session
128-
nmap <leader>psl :SessionList<CR>
129-
" Save session
130-
nmap <leader>pss :SessionSave<CR>
131-
" }}}
132-
" Accordion {{{
133-
" Start accordion with 3 splits by default
134-
nmap <silent><leader>bas :AccordionAll 3<CR>
135-
" Stop layout management
136-
nmap <silent><leader>bac :AccordionStop<CR>
137-
" -1 split visible
138-
nmap <silent><leader>bai :AccordionZoomIn<CR>
139-
" +1 split visible
140-
nmap <silent><leader>bao :AccordionZoomOut<CR>
141-
" }}}
142-
" Undotree {{{
143-
nnoremap <silent><leader>bu :UndotreeToggle<CR>:UndotreeFocus<CR>
144-
" }}}
145-
" }}}
146-
" Git {{{
147-
" Fugutive {{{
148-
" Stage file
149-
nmap <silent><Leader>gw :GWrite<CR>
150-
" Git status
151-
nmap <silent><Leader>gs :G<CR>
152-
" }}}
153-
" GV {{{
154-
nnoremap <silent><leader>gl :GV<CR>
155-
" }}}
156-
" }}}
157-
" Code {{{
158-
" NERDCommenter {{{
159-
" Map toggle comment
160-
map <silent><Leader>c<space> <Plug>NERDCommenterToggle
161-
" }}}
162-
" }}}
163-
" CoC {{{
164-
" General {{{
165-
" Extensions could be used for CoC to have more powerful features
166-
" Here is the list:
167-
" https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions << Explanation
168-
" https://www.npmjs.com/search?q=keywords%3Acoc.nvim << Actual list
16982

170-
" use <tab> for trigger completion and navigate to next complete item
171-
function! s:check_back_space() abort
172-
let col = col('.') - 1
173-
return !col || getline('.')[col - 1] =~# '\s'
174-
endfunction
175-
176-
" Next by Tab
177-
inoremap <silent><expr> <TAB>
178-
\ pumvisible() ? "\<C-n>" :
179-
\ <SID>check_back_space() ? "\<TAB>" :
180-
\ coc#rpc#request('doKeymap', ['snippets-expand', "\<TAB>"])
181-
182-
" Previous by Tab
183-
inoremap <silent><expr><S-Tab>
184-
\ pumvisible() ? "\<C-p>" :
185-
\ <SID>check_back_space() ? "\<S-Tab>" :
186-
\ coc#rpc#request('doKeymap', ['snippets-expand', "\<S-Tab>"])
187-
188-
" use <c-space>for trigger completion
189-
imap <silent><expr> <c-space> coc#refresh()
190-
191-
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
192-
" position. Coc only does snippet and additional edit on confirm.
193-
if has('patch8.1.1068')
194-
" Use `complete_info` if your (Neo)Vim version supports it.
195-
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
196-
else
197-
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
198-
endif
199-
200-
" Use <C-j> to select text for visual text of snippet.
201-
vmap <C-j> <Plug>(coc-snippets-select)
202-
203-
" Show doc
204-
function! s:show_doc()
205-
if (index(['vim','help'], &filetype) >= 0)
206-
execute 'h '.expand('<cword>')
207-
else
208-
call CocAction('doHover')
209-
endif
210-
endfunction
211-
212-
fun! s:jump_definition()
213-
if (index(['vim', 'help'], &filetype) >= 0)
214-
execute 'tag '.expand('<cword>')
215-
else
216-
call CocAction('jumpDefinition', v:false)
217-
endif
218-
endf
219-
220-
" Now jump usage
221-
nnoremap <silent> K :call <SID>show_doc()<CR>
222-
223-
" GoTos
224-
nnoremap <silent><C-]> :call <SID>jump_definition()<CR>
225-
nnoremap <silent><leader>ld :call CocAction('jumpDeclaration', v:false)<CR>
226-
nnoremap <silent><leader>li :call CocAction('jumpImplementation', v:false)<CR>
227-
nnoremap <silent><leader>lr :call CocAction('jumpReferences', v:false)<CR>
228-
229-
" Use `[g` and `]g` to navigate diagnostics
230-
nmap <silent> [e <Plug>(coc-diagnostic-prev)
231-
nmap <silent> ]e <Plug>(coc-diagnostic-next)
232-
" and qf to fix em (or try at least
233-
nmap <silent><leader>lqf <Plug>(coc-fix-current)
234-
" Add `:OR` command for organize imports of the current buffer.
235-
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
236-
237-
" Other helpful stuff
238-
nnoremap <silent><leader>gC :call CocAction('codeAction')<CR>
239-
nnoremap <silent><leader>gR :call CocAction('rename')<CR>
240-
nnoremap <silent><leader>gq :call CocAction('quickfixes')<CR>
241-
nnoremap <silent><leader>,. :call CocActionAsync('format')<CR>
242-
nnoremap <silent><leader>gL :CocList<CR>
83+
" NvimTree {{{
84+
nnoremap<silent> <leader>be :NvimTreeToggle<CR>
85+
" }}}
24386

244-
" }}}
245-
" }}}
87+
" Easy Align {{{
88+
" Start interactive EasyAlign in visual mode (e.g. vipga)
89+
xmap ga <Plug>(EasyAlign)
90+
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
91+
nmap ga <Plug>(EasyAlign)
24692
" }}}

bindings/whichkey.vim

Lines changed: 0 additions & 65 deletions
This file was deleted.

coc-settings.json

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)