nvim: plugins: Drop vim-husk

There has not been any update to the plugin in 8 years. Just drop
it from the plugin list and incorporate it directly in our config.
This commit is contained in:
Sanchayan Maity 2023-06-19 12:21:15 +05:30
parent 551ca63dfa
commit 89dd0df8a1
Signed by: sanchayanmaity
GPG Key ID: 6F6A0609C12038F3
3 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,39 @@
function! husk#left()
let line = getcmdline()
let pos = getcmdpos()
let next = 1
let nextnext = 1
let i = 2
while nextnext < pos
let next = nextnext
let nextnext = match(line, '\<\S\|\>\S\|\s\zs\S\|^\|$', 0, i) + 1
let i += 1
endwhile
return repeat("\<Left>", pos - next)
endfunction
function! husk#abstract_right(command)
let line = getcmdline()
let pos = getcmdpos()
let next = 1
let i = 2
while next <= pos && next > 0
let next = match(line, '\<\S\|\>\S\|\s\zs\S\|^\|$', 0, i) + 1
let i += 1
endwhile
return repeat(a:command, next - pos)
endfunction
function! husk#right()
return husk#abstract_right("\<Right>")
endfunction
function! husk#del_word()
return husk#abstract_right("\<Right>\<BS>")
endfunction
function! husk#clear_line_after_cursor()
let pos = getcmdpos()
let line_len = strlen(getcmdline())
return repeat("\<Del>", line_len - pos + 1)
endfunction

View File

@ -98,7 +98,13 @@ remap('c', '<S-Tab>', 'getcmdtype() =~ \'[?/]\' ? \'<C-t>\' : feedkeys(\'<S-Tab>
remap('c', '<Up>' , 'pumvisible() ? feedkeys(\'<S-Tab>\', \'int\')[1] : \'<Up>\'' , expr_opts)
remap('c', '<Down>', 'pumvisible() ? feedkeys(\'<Tab>\' , \'int\')[1] : \'<Down>\'', expr_opts)
remap('n', '<F2>', ':TSHighlightCapturesUnderCursor<CR>', opts)
-- Husk mappings
remap('c', '<C-a>', '<Home>' , opts )
remap('c', '<C-e>', '<End>' , opts )
remap('c', '<C-b>', 'husk#left()' , expr_opts)
remap('c', '<C-f>', 'husk#right()' , expr_opts)
remap('c', '<C-d>', 'husk#del_word()' , expr_opts)
remap('c', '<C-k>', 'husk#clear_line_after_cursor()', expr_opts)
-- After shifting a visual block, select it again
remap('v', '<', '<gv', opts)

View File

@ -9,7 +9,6 @@ require "paq" {
'lewis6991/gitsigns.nvim' ,
'tpope/vim-fugitive' ,
'SanchayanMaity/gitlinker.nvim' ,
'vim-utils/vim-husk' ,
'yorickpeterse/nvim-pqf' ,
'wellle/targets.vim' ,
'chrisgrieser/nvim-various-textobjs',