Add hlslens
This commit is contained in:
parent
e886709d98
commit
43d476107e
3 changed files with 47 additions and 0 deletions
|
@ -23,6 +23,14 @@ local function init()
|
||||||
map('n', '<space>r', '<cmd>lua vim.lsp.buf.references()<CR>')
|
map('n', '<space>r', '<cmd>lua vim.lsp.buf.references()<CR>')
|
||||||
map('n', '<space>s', '<cmd>lua vim.lsp.buf.document_symbol()<CR>')
|
map('n', '<space>s', '<cmd>lua vim.lsp.buf.document_symbol()<CR>')
|
||||||
|
|
||||||
|
-------------------- HlsLens -------------------------------
|
||||||
|
map('n', 'n', "<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
map('n', 'N', "<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
map('n', '*', "*<Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
map('n', '#', "#<Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
map('n', 'g*', "g*<Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
map('n', 'g#', "g#<Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
|
||||||
-------------------- LAZYGIT -------------------------------
|
-------------------- LAZYGIT -------------------------------
|
||||||
-- Install docs : https://github.com/jesseduffield/lazygit
|
-- Install docs : https://github.com/jesseduffield/lazygit
|
||||||
map('n', '<space>lg', '<cmd>LazyGit<CR>')
|
map('n', '<space>lg', '<cmd>LazyGit<CR>')
|
||||||
|
|
|
@ -6,6 +6,7 @@ function configure_packages()
|
||||||
call_with_helpers(require('plugins.nvim-comment').init)
|
call_with_helpers(require('plugins.nvim-comment').init)
|
||||||
call_with_helpers(require('plugins.nvim-autopairs').init)
|
call_with_helpers(require('plugins.nvim-autopairs').init)
|
||||||
call_with_helpers(require('plugins.nvim-notify').init)
|
call_with_helpers(require('plugins.nvim-notify').init)
|
||||||
|
call_with_helpers(require('plugins.nvim-hlslens').init)
|
||||||
end
|
end
|
||||||
|
|
||||||
function install_packages()
|
function install_packages()
|
||||||
|
@ -34,6 +35,8 @@ function install_packages()
|
||||||
use 'terrortylor/nvim-comment'
|
use 'terrortylor/nvim-comment'
|
||||||
use 'rcarriga/nvim-notify' -- fancy notification
|
use 'rcarriga/nvim-notify' -- fancy notification
|
||||||
use 'romgrk/barbar.nvim' -- Tabs, as understood by any other editor.
|
use 'romgrk/barbar.nvim' -- Tabs, as understood by any other editor.
|
||||||
|
use 'tpope/vim-endwise' -- auto complete block with end
|
||||||
|
use 'kevinhwang91/nvim-hlslens' -- nvim-hlslens helps you better glance at matched information, seamlessly jump between matched instances.
|
||||||
use 'mhinz/vim-startify' -- The fancy start screen for Vim.
|
use 'mhinz/vim-startify' -- The fancy start screen for Vim.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
36
configs/nvim/lua/plugins/nvim-hlslens.lua
Normal file
36
configs/nvim/lua/plugins/nvim-hlslens.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local function init()
|
||||||
|
require('hlslens').setup {
|
||||||
|
calm_down = true,
|
||||||
|
override_lens = function(render, plist, nearest, idx, r_idx)
|
||||||
|
local sfw = vim.v.searchforward == 1
|
||||||
|
local indicator, text, chunks
|
||||||
|
local abs_r_idx = math.abs(r_idx)
|
||||||
|
if abs_r_idx > 1 then
|
||||||
|
indicator = string.format('%d%s', abs_r_idx, sfw ~= (r_idx > 1) and '' or '')
|
||||||
|
elseif abs_r_idx == 1 then
|
||||||
|
indicator = sfw ~= (r_idx == 1) and '' or ''
|
||||||
|
else
|
||||||
|
indicator = ''
|
||||||
|
end
|
||||||
|
|
||||||
|
local lnum, col = unpack(plist[idx])
|
||||||
|
if nearest then
|
||||||
|
local cnt = #plist
|
||||||
|
if indicator ~= '' then
|
||||||
|
text = string.format('[%s %d/%d]', indicator, idx, cnt)
|
||||||
|
else
|
||||||
|
text = string.format('[%d/%d]', idx, cnt)
|
||||||
|
end
|
||||||
|
chunks = {{' ', 'Ignore'}, {text, 'HlSearchLensNear'}}
|
||||||
|
else
|
||||||
|
text = string.format('[%s %d]', indicator, idx)
|
||||||
|
chunks = {{' ', 'Ignore'}, {text, 'HlSearchLens'}}
|
||||||
|
end
|
||||||
|
render.set_virt(0, lnum - 1, col - 1, chunks, nearest)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
init = init
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue