diff options
-rw-r--r-- | .config/nvim/bindings.vim | 62 | ||||
-rw-r--r-- | .config/nvim/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/bindings.lua | 69 |
3 files changed, 70 insertions, 63 deletions
diff --git a/.config/nvim/bindings.vim b/.config/nvim/bindings.vim deleted file mode 100644 index c54e82b..0000000 --- a/.config/nvim/bindings.vim +++ /dev/null @@ -1,62 +0,0 @@ -call which_key#register('\', "g:which_key_map") -let g:which_key_map = {} -nnoremap c "_c -nnoremap <M-;> :call nerdcommenter#Comment(0,"toggle")<CR> -nnoremap <M-x> : -nnoremap <silent> <M-k> :bprevious<CR> -nnoremap <silent> <M-j> :bnext<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 -nnoremap <C-o> <C-w>o -nnoremap <C-q> <C-w>q -nnoremap <C-d> <C-d>zz -nnoremap <C-u> <C-u>zz -nnoremap <silent> <leader> :WhichKey '\'<CR> -nnoremap <silent> <leader>b :Buffers<CR> -nnoremap <leader>d :bd<CR> -nnoremap <silent> <leader>e :Files<CR> -nnoremap <silent> <leader>ga :Ag<CR> -nnoremap <leader>gg :Grep<Space> -nnoremap <silent> <leader>gr :Rg<CR> -nnoremap <silent> <leader>G :FloatermNew lazygit<CR> -nnoremap <silent> <leader>h :Startify<CR> -nnoremap <leader>k :w<CR>:bp<CR>:bd #<CR> -nnoremap <silent> <leader>p :<C-u>CocList -A --normal yank<CR> -nnoremap <silent> <leader>v :FloatermNew vifm<CR> -nnoremap <leader>w :w<CR> -nnoremap <leader>x :w<CR>:bp<CR>:bd #<CR> -let g:which_key_map.b = 'buffers' -let g:which_key_map.c = { 'name': '+nerd-commenter' } -let g:which_key_map.d = 'close-buffer' -let g:which_key_map.e = 'files' -let g:which_key_map.g = { 'name': '+grep' } -let g:which_key_map.g.a = 'the_silver_searcher' -let g:which_key_map.g.g = 'grep' -let g:which_key_map.g.r = 'ripgrep' -let g:which_key_map.G = 'lazygit' -let g:which_key_map.h = 'startify' -let g:which_key_map.k = 'write-and-close-buffer' -let g:which_key_map.p = 'coc-paste' -let g:which_key_map.q = { 'name': '+coc-fix-current' } -let g:which_key_map.r = { 'name': '+coc-rename' } -let g:which_key_map.v = 'vifm' -let g:which_key_map.w = 'write-buffer' -let g:which_key_map.x = 'write-and-close-buffer' -nmap <M-1> <Plug>AirlineSelectTab1 -nmap <M-2> <Plug>AirlineSelectTab2 -nmap <M-3> <Plug>AirlineSelectTab3 -nmap <M-4> <Plug>AirlineSelectTab4 -nmap <M-5> <Plug>AirlineSelectTab5 -nmap <M-6> <Plug>AirlineSelectTab6 -nmap <M-7> <Plug>AirlineSelectTab7 -nmap <M-8> <Plug>AirlineSelectTab8 -nmap <M-9> <Plug>AirlineSelectTab9 -nmap <M-0> <Plug>AirlineSelectTab10 -inoremap <expr> <C-j> pumvisible() ? "<C-n>" : "<C-j>" -inoremap <expr> <C-k> pumvisible() ? "<C-p>" : "<C-k>" -inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>" -let g:floaterm_keymap_toggle = '<F1>' -let g:floaterm_keymap_prev = '<F11>' -let g:floaterm_keymap_next = '<F12>' diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 739cd29..1940060 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -17,8 +17,8 @@ vim.cmd('set runtimepath^=/home/r_bousset/.config/nvim runtimepath+=/home/jozan/ vim.cmd('let &packpath = &runtimepath') require('plug') require('settings') +require('bindings') require('plugs-config/treesitter') -vim.cmd('source ' .. confdir .. '/nvim/bindings.vim') vim.cmd('source ' .. confdir .. '/nvim/sidebars.vim') vim.cmd('source ' .. confdir .. '/nvim/langs.vim') vim.cmd('source ' .. confdir .. '/nvim/plug-config/airline.vim') diff --git a/.config/nvim/lua/bindings.lua b/.config/nvim/lua/bindings.lua new file mode 100644 index 0000000..08d72e1 --- /dev/null +++ b/.config/nvim/lua/bindings.lua @@ -0,0 +1,69 @@ +vim.call('which_key#register', '\\', 'g:which_key_map') +vim.g.which_key_map = {} +vim.keymap.set('n', 'c', '"_c', { noremap = true, silent = false }) +vim.keymap.set('n', 'M-;', ':call nerdcommenter#Comment(0,"toggle")<CR>', { noremap = true, silent = false }) +vim.keymap.set('n', 'M-x', ':', { noremap = true, silent = false }) +vim.keymap.set('n', '<M-k>', ':bprevious<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<M-j>', ':bnext<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<C-h>', '<C-w>h', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-j>', '<C-w>j', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-k>', '<C-w>k', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-l>', '<C-w>l', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-o>', '<C-w>o', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-q>', '<C-w>q', { noremap = true, silent = false }) +vim.keymap.set('n', '*', '*zz', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = false }) +vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = false }) +vim.keymap.set('n', '<leader>', ":WhichKey '\\'<CR>", { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>b', ':Buffers<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>d', ':bd<CR>', { noremap = true, silent = false }) +vim.keymap.set('n', '<leader>e', ':Files<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>ga', ':Ag<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>gg', ':Grep<Space>', { noremap = true, silent = false }) +vim.keymap.set('n', '<leader>gr', ':Rg<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>G', ':FloatermNew lazygit<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>h', ':Startify<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>k', ':w<CR>:bp<CR>:bd #<CR>', { noremap = true, silent = false }) +vim.keymap.set('n', '<leader>p', ':<C-u>CocList -A --normal yank<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<silent><leader>v', ':FloatermNew vifm<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>w', ':w<CR>', { noremap = true, silent = false }) +vim.keymap.set('n', '<leader>x', ':w<CR>:bp<CR>:bd #<CR>', { noremap = true, silent = false }) +vim.keymap.set('n', '<M-1>', '<Plug>AirlineSelectTab1') +vim.keymap.set('n', '<M-2>', '<Plug>AirlineSelectTab2') +vim.keymap.set('n', '<M-3>', '<Plug>AirlineSelectTab3') +vim.keymap.set('n', '<M-4>', '<Plug>AirlineSelectTab4') +vim.keymap.set('n', '<M-5>', '<Plug>AirlineSelectTab5') +vim.keymap.set('n', '<M-6>', '<Plug>AirlineSelectTab6') +vim.keymap.set('n', '<M-7>', '<Plug>AirlineSelectTab7') +vim.keymap.set('n', '<M-8>', '<Plug>AirlineSelectTab8') +vim.keymap.set('n', '<M-9>', '<Plug>AirlineSelectTab9') +vim.keymap.set('n', '<M-0>', '<Plug>AirlineSelectTab10') +vim.keymap.set('i', '<expr> <C-j>', 'pumvisible() ? "<C-n>" : "<C-j>"') +vim.keymap.set('i', '<expr> <C-k>', 'pumvisible() ? "<C-p>" : "<C-k>"') +vim.keymap.set('i', '<expr> <cr>', 'pumvisible() ? asyncomplete#close_popup() : "\\<cr>"') +vim.g.floaterm_keymap_toggle = '<F1>' +vim.g.floaterm_keymap_prev = '<F11>' +vim.g.floaterm_keymap_next = '<F12>' +vim.cmd [[ +let g:which_key_map = { +\ 'b': 'buffers', +\ 'c': { 'name': '+nerd-commenter' }, +\ 'd': 'close-buffer', +\ 'e': 'files', +\ 'G': 'lazygit', +\ 'h': 'startify', +\ 'k': 'write-and-close-buffer', +\ 'p': 'coc-paste', +\ 'q': { 'name': '+coc-fix-current' }, +\ 'r': { 'name': '+coc-rename' }, +\ 'v': 'vifm', +\ 'w': 'write-buffer', +\ 'x': 'write-and-close-buffer', +\ 'g': { 'name': '+grep' } +\ } +let g:which_key_map.g = { +\ 'a': 'the_silver_searcher', +\ 'g': 'grep', +\ 'r': 'ripgrep' +\ } +]] |