Skip to content

Commit

Permalink
chore: using snacks.nvim's indent and statuscolumn, also opt-in into …
Browse files Browse the repository at this point in the history
…fzf lsp
  • Loading branch information
shubham-cpp committed Dec 15, 2024
1 parent f0a1efb commit 1012f94
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .config/lazygit/state.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
lastupdatecheck: 0
recentrepos:
- /home/shubham/Documents/Programming/WebDev/vue3-chrome-ai
- /home/shubham/Documents/dotfiles
- /home/shubham/Documents/Programming/WebDev/invoice-generator-sveltekit
- /home/shubham/Documents/Programming/WebDev/vue3-chrome-ai
- /home/shubham/Documents/Programming/WebDev/demo-shadcn
- /home/shubham/Downloads/GitClones/srcbook
- /home/shubham/Documents/Programming/WebDev/page-form
Expand Down
118 changes: 107 additions & 11 deletions .config/nvim/lua/plugins/config/astrolsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,32 @@ M.opts = {
gl = { vim.diagnostic.open_float, desc = 'Hover diagnostics' },
['<leader>le'] = { vim.diagnostic.open_float, desc = 'Hover diagnostics' },
['<leader>ld'] = {
vim.lsp.buf.definition,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.definition()
else
fzf.lsp_definitions({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
end,
desc = 'Goto definition',
cond = 'textDocument/definition',
},
gd = {
vim.lsp.buf.definition,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.definition()
else
fzf.lsp_definitions({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
end,
desc = 'Goto definition',
cond = 'textDocument/definition',
},
Expand All @@ -75,14 +95,42 @@ M.opts = {
cond = 'textDocument/codeAction',
},
['<leader>li'] = {
vim.lsp.buf.implementation,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.implementation()
else
fzf.lsp_implementations()
end
end,
desc = 'Goto implementation',
cond = 'textDocument/implementation',
},
-- condition for only server with declaration capabilities
['<leader>lD'] = { vim.lsp.buf.declaration, desc = 'Goto Declaration', cond = 'textDocument/declaration' },
['<leader>lD'] = {
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.declaration()
else
fzf.lsp_declarations({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
end,
desc = 'Goto Declaration',
cond = 'textDocument/declaration',
},
['<leader>lt'] = {
vim.lsp.buf.type_definition,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.type_definition()
else
fzf.lsp_typedefs()
end
end,
desc = 'Type definition',
cond = 'textDocument/typeDefinition',
},
Expand All @@ -95,12 +143,32 @@ M.opts = {
end,
},
gr = {
vim.lsp.buf.references,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.references()
else
fzf.lsp_references({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
end,
desc = 'Goto references',
cond = 'textDocument/references',
},
['<leader>lR'] = {
vim.lsp.buf.references,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.references()
else
fzf.lsp_references({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
end,
desc = 'Goto references',
cond = 'textDocument/references',
},
Expand All @@ -125,12 +193,26 @@ M.opts = {
desc = 'Goto Next diagnostic',
},
['<leader>lw'] = {
vim.lsp.buf.document_symbol,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.document_symbol()
else
fzf.lsp_document_symbols()
end
end,
desc = 'Document symbols',
cond = 'textDocument/documentSymbol',
},
['<leader>lW'] = {
vim.lsp.buf.workspace_symbol,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.workspace_symbol()
else
fzf.lsp_workspace_symbols()
end
end,
desc = 'Workspace symbols',
cond = 'workspace/symbol',
},
Expand All @@ -145,7 +227,14 @@ M.opts = {
cond = 'textDocument/rename',
},
['<leader>la'] = {
vim.lsp.buf.code_action,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.code_action()
else
fzf.lsp_code_actions()
end
end,
desc = 'Code actions',
cond = 'textDocument/codeAction',
},
Expand Down Expand Up @@ -184,7 +273,14 @@ M.opts = {
},
x = {
['<leader>la'] = {
vim.lsp.buf.code_action,
function()
local ok, fzf = pcall(require, 'fzf-lua')
if not ok then
vim.lsp.buf.code_action()
else
fzf.lsp_code_actions()
end
end,
desc = 'Code actions',
cond = 'textDocument/codeAction',
},
Expand Down
71 changes: 36 additions & 35 deletions .config/nvim/lua/plugins/config/fzf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,42 +176,43 @@ if not ok_dressing then
fzf.register_ui_select()
end

vim.lsp.handlers['textDocument/codeAction'] = fzf.lsp_code_actions
vim.lsp.handlers['textDocument/references'] = function()
fzf.lsp_references({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
-- vim.lsp.handlers['textDocument/codeAction'] = fzf.lsp_code_actions
-- vim.lsp.handlers['textDocument/references'] = function()
-- fzf.lsp_references({
-- jump_to_single_result = true,
-- winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
-- })
-- end
--
-- vim.lsp.handlers['textDocument/definition'] = function()
-- fzf.lsp_definitions({
-- jump_to_single_result = true,
-- winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
-- })
-- end
-- vim.lsp.handlers['textDocument/declaration'] = function()
-- fzf.lsp_declarations({
-- jump_to_single_result = true,
-- winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
-- })
-- end
-- vim.lsp.handlers['textDocument/typeDefinition'] = fzf.lsp_typedefs
-- vim.lsp.handlers['textDocument/implementation'] = fzf.lsp_implementations
--
-- vim.lsp.handlers['textDocument/documentSymbol'] = fzf.lsp_document_symbols
-- vim.lsp.handlers['workspace/symbol'] = fzf.lsp_workspace_symbols
--
-- vim.lsp.handlers['callHierarchy/incomingCalls'] = function()
-- fzf.lsp_incoming_calls({
-- winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
-- })
-- end
-- vim.lsp.handlers['callHierarchy/outgoingCalls'] = function()
-- fzf.lsp_outgoing_calls({
-- winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
-- })
-- end

vim.lsp.handlers['textDocument/definition'] = function()
fzf.lsp_definitions({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
vim.lsp.handlers['textDocument/declaration'] = function()
fzf.lsp_declarations({
jump_to_single_result = true,
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
vim.lsp.handlers['textDocument/typeDefinition'] = fzf.lsp_typedefs
vim.lsp.handlers['textDocument/implementation'] = fzf.lsp_implementations

vim.lsp.handlers['textDocument/documentSymbol'] = fzf.lsp_document_symbols
vim.lsp.handlers['workspace/symbol'] = fzf.lsp_workspace_symbols

vim.lsp.handlers['callHierarchy/incomingCalls'] = function()
fzf.lsp_incoming_calls({
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
vim.lsp.handlers['callHierarchy/outgoingCalls'] = function()
fzf.lsp_outgoing_calls({
winopts = { preview = { layout = 'vertical', vertical = 'up:60%' } },
})
end
local function fzf_create_file()
local fzf = require 'fzf-lua'
local path = require 'fzf-lua.path'
Expand Down
16 changes: 8 additions & 8 deletions .config/nvim/lua/plugins/config/heirline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ heirline.setup({
-- lib.component.compiler_redo(),
-- lib.component.aerial(),
},
statuscolumn = { -- UI left column
init = function(self)
self.bufnr = vim.api.nvim_get_current_buf()
end,
lib.component.foldcolumn(),
lib.component.numbercolumn(),
lib.component.signcolumn(),
} or nil,
-- statuscolumn = { -- UI left column
-- init = function(self)
-- self.bufnr = vim.api.nvim_get_current_buf()
-- end,
-- lib.component.foldcolumn(),
-- lib.component.numbercolumn(),
-- lib.component.signcolumn(),
-- } or nil,
statusline = { -- UI statusbar
hl = { fg = 'fg', bg = 'bg' },
lib.component.mode(),
Expand Down
3 changes: 2 additions & 1 deletion .config/nvim/lua/plugins/grapple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ return {
status = false,
},
keys = {
{ '<leader>a', '<cmd>Grapple toggle<cr>', desc = 'Tag a file' },
{ '<leader>A', '<cmd>Grapple toggle<cr>', desc = 'Tag a file' },
{ '<leader>`', '<cmd>Grapple toggle<cr>', desc = 'Tag a file' },
{ '<c-e>', '<cmd>Grapple toggle_tags<cr>', desc = 'Toggle tags menu' },

{ "'1", '<cmd>Grapple select index=1<cr>', desc = 'Select first tag' },
Expand Down
13 changes: 12 additions & 1 deletion .config/nvim/lua/plugins/lsp/zk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,19 @@ local config = {
},
},
config = function()
local picker = 'select'
local ok_fzf, _ = pcall(require, 'fzf-lua')
if ok_fzf then
picker = 'fzf_lua'
else
local ok_telescope, _ = pcall(require, 'telescope')
if ok_telescope then
picker = 'telescope'
end
end

require('zk').setup({
picker = 'telescope', -- "telescope", "fzf", "fzf_lua" or "select"
picker = picker, -- "telescope", "fzf", "fzf_lua" or "select"
lsp = {
config = {
on_attach = function(_, bufnr)
Expand Down
2 changes: 1 addition & 1 deletion .config/nvim/lua/plugins/mini/indent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local au_group = vim.api.nvim_create_augroup('sp_indent', { clear = true })
return {
'echasnovski/mini.indentscope',
version = false,
enabled = true,
enabled = false,
event = 'BufReadPost',
config = function()
require('mini.indentscope').setup({
Expand Down
31 changes: 30 additions & 1 deletion .config/nvim/lua/plugins/snacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,30 @@ return {
bigfile = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
statuscolumn = { enabled = false },
statuscolumn = {
enabled = true,
folds = {
open = true, -- show open fold icons
},
},
words = { enabled = true },
scope = { enabled = true },
indent = {
enabled = true,
indent = {
only_current = true,
chunk = {
-- when enabled, scopes will be rendered as chunks, except for the
-- top-level scope which will be rendered as a scope.
enabled = true,
},
},
chunk = {
-- when enabled, scopes will be rendered as chunks, except for the
-- top-level scope which will be rendered as a scope.
enabled = true,
},
},
},

keys = {
Expand All @@ -26,6 +48,13 @@ return {
end,
desc = 'Git Blame Line',
},
{
'<leader>go',
function()
Snacks.gitbrowse.open()
end,
desc = 'Git Open Line',
},
{
']]',
function()
Expand Down

0 comments on commit 1012f94

Please sign in to comment.