Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from LSP Saga to Dressing #195

Merged
merged 4 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions lua/configs/dressing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
local M = {}

function M.config()
local present, dressing = pcall(require, "dressing")
if not present then
return
end

dressing.setup(require("core.utils").user_plugin_opts("plugins.dressing", {
input = {
enabled = true,
default_prompt = "➤ ",
prompt_align = "left",
insert_only = true,
anchor = "SW",
border = "rounded",
relative = "cursor",
prefer_width = 40,
width = nil,
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
winblend = 10,
winhighlight = "",
override = function(conf)
return conf
end,
get_config = nil,
},
select = {
enabled = true,
backend = { "telescope", "builtin" },

builtin = {
anchor = "NW",
border = "rounded",
relative = "editor",
winblend = 10,
winhighlight = "",
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
override = function(conf)
return conf
end,
},
format_item_override = {},
get_config = nil,
},
}))
end

return M
14 changes: 1 addition & 13 deletions lua/configs/lsp/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ local function lsp_highlight_document(client)
end
end

local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
end

M.on_attach = function(client, bufnr)
if client.name == "tsserver" then
client.resolved_capabilities.document_formatting = false
Expand All @@ -84,7 +72,7 @@ M.on_attach = function(client, bufnr)
on_attach_override(client, bufnr)
end

lsp_keymaps(bufnr)
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
lsp_highlight_document(client)
end

Expand Down
53 changes: 0 additions & 53 deletions lua/configs/lsp/lspsaga.lua

This file was deleted.

1 change: 0 additions & 1 deletion lua/core/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ local config = {
bufferline = true,
nvim_tree = true,
lualine = true,
lspsaga = true,
gitsigns = true,
colorizer = true,
toggle_term = true,
Expand Down
29 changes: 16 additions & 13 deletions lua/core/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,22 @@ map("n", "<leader>ls", "<cmd>Telescope lsp_document_symbols<CR>", opts)
map("n", "<leader>lR", "<cmd>Telescope lsp_references<CR>", opts)
map("n", "<leader>lD", "<cmd>Telescope diagnostics<CR>", opts)

-- Lspsaga
if config.enabled.lspsaga then
map("n", "gl", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)
map("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts)
map("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts)
map("n", "gj", "<cmd>Lspsaga diagnostic_jump_next<cr>", opts)
map("n", "gk", "<cmd>Lspsaga diagnostic_jump_prev<cr>", opts)
map("n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<cr>", opts)
map("n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<cr>", opts)
map("n", "<leader>la", "<cmd>Lspsaga code_action<CR>", opts)
map("n", "<leader>lr", "<cmd>Lspsaga rename<CR>", opts)
map("n", "<leader>ld", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)
end
-- LSP
map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
map("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
map("n", "go", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
map("n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev({ border = 'rounded' })<CR>", opts)
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next({ border = 'rounded' })<CR>", opts)
map("n", "gj", "<cmd>lua vim.diagnostic.goto_next({ border = 'rounded' })<cr>", opts)
map("n", "gk", "<cmd>lua vim.diagnostic.goto_prev({ border = 'rounded' })<cr>", opts)
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
map("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
map("n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
map("n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
map("n", "<leader>ld", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)

-- Comment
if config.enabled.comment then
Expand Down
19 changes: 9 additions & 10 deletions lua/core/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ local astro_plugins = {
end,
},

-- Neovim UI Enhancer
{
"stevearc/dressing.nvim",
event = "BufWinEnter",
config = function()
require("configs.dressing").config()
end,
},

-- Cursorhold fix
{
"antoinemadec/FixCursorHold.nvim",
Expand Down Expand Up @@ -208,16 +217,6 @@ local astro_plugins = {
end,
},

-- LSP enhancer
{
"tami5/lspsaga.nvim",
event = "BufRead",
config = function()
require("configs.lsp.lspsaga").config()
end,
disable = not config.enabled.lspsaga,
},

-- LSP symbols
{
"simrat39/symbols-outline.nvim",
Expand Down
1 change: 0 additions & 1 deletion lua/user_example/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ local config = {
bufferline = true,
nvim_tree = true,
lualine = true,
lspsaga = true,
gitsigns = true,
colorizer = true,
toggle_term = true,
Expand Down