diff --git a/lua/cosmic/core/file-navigation/init.lua b/lua/cosmic/core/file-navigation/init.lua index b289e23..b7dee96 100644 --- a/lua/cosmic/core/file-navigation/init.lua +++ b/lua/cosmic/core/file-navigation/init.lua @@ -2,6 +2,32 @@ local actions = require('telescope.actions') local mappings = require('cosmic.core.file-navigation.mappings').mappings() local icons = require('cosmic.core.theme.icons') +local opts_cursor = { + initial_mode = 'normal', + sorting_strategy = 'ascending', + layout_strategy = 'cursor', + preview_title = false, + results_title = false, + layout_config = { + width = 0.3, + height = 0.3, + }, + mappings = mappings, +} + +local opts_vertical = { + initial_mode = 'normal', + sorting_strategy = 'ascending', + layout_strategy = 'vertical', + results_title = false, + layout_config = { + width = 0.3, + height = 0.5, + prompt_position = 'top', + mirror = true, + }, +} + require('telescope').setup({ defaults = { prompt_prefix = '🔍 ', @@ -41,66 +67,25 @@ require('telescope').setup({ sort_mru = true, preview_title = false, }, - lsp_references = { - initial_mode = 'normal', - sorting_strategy = 'ascending', - layout_strategy = 'cursor', - preview_title = false, - results_title = false, - prompt_title = 'References', - layout_config = { - width = 0.4, - height = 0.4, - }, - }, - lsp_code_actions = { - initial_mode = 'normal', - sorting_strategy = 'ascending', - layout_strategy = 'cursor', - preview = false, + lsp_code_actions = vim.tbl_deep_extend('force', opts_cursor, { prompt_title = 'Code Actions', - results_title = '', - layout_config = { - width = 0.2, - height = 0.3, - }, - }, - lsp_range_code_actions = { - initial_mode = 'normal', - sorting_strategy = 'ascending', - layout_strategy = 'cursor', - preview = false, + }), + lsp_range_code_actions = vim.tbl_deep_extend('force', opts_vertical, { prompt_title = 'Code Actions', - results_title = '', - layout_config = { - width = 0.3, - height = 0.3, - }, - }, - lsp_document_diagnostics = { - initial_mode = 'normal', - sorting_strategy = 'ascending', - layout_strategy = 'vertical', - prompt_title = 'Diagnostics', - results_title = '', - layout_config = { - width = 0.5, - height = 0.5, - prompt_position = 'top' - }, + }), + lsp_document_diagnostics = vim.tbl_deep_extend('force', opts_vertical, { + prompt_title = 'Document Diagnostics', mappings = mappings, - }, - lsp_definitions = { - layout_strategy = 'cursor', + }), + lsp_implementations = vim.tbl_deep_extend('force', opts_cursor, { + prompt_title = 'Implementations', + }), + lsp_definitions = vim.tbl_deep_extend('force', opts_cursor, { prompt_title = 'Definitions', - preview_title = false, - results_title = false, - layout_config = { - width = 0.5, - height = 0.5, - }, - mappings = mappings, - }, + }), + lsp_references = vim.tbl_deep_extend('force', opts_cursor, { + prompt_title = 'References', + }), find_files = { prompt_title = '✨ Search Project ✨', mappings = mappings, diff --git a/lua/cosmic/lsp/diagnostics.lua b/lua/cosmic/lsp/diagnostics.lua index 0200db9..b5ecc3b 100644 --- a/lua/cosmic/lsp/diagnostics.lua +++ b/lua/cosmic/lsp/diagnostics.lua @@ -22,7 +22,7 @@ function M.init() signs = true, severity_sort = true, float = { - show_header = true, + show_header = false, source = 'always', border = 'single', }, diff --git a/lua/cosmic/lsp/mappings.lua b/lua/cosmic/lsp/mappings.lua index 87d26a4..b3aade3 100644 --- a/lua/cosmic/lsp/mappings.lua +++ b/lua/cosmic/lsp/mappings.lua @@ -4,18 +4,18 @@ local map = require('cosmic.utils').map local opts = { noremap = true, silent = true } -- See `:help vim.lsp.*` for documentation on any of the below functions -map('n', 'gd', 'lua vim.lsp.buf.definition()', opts) -map('n', 'gd', 'lua vim.lsp.buf.declaration()', opts) -map('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) -map('n', 'gt', 'lua vim.lsp.buf.type_definition()', opts) +map('n', 'gd', 'lua require("telescope.builtin").lsp_definitions()', opts) +map('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) +map('n', 'gi', 'lua require("telescope.builtin").lsp_implementations()', opts) +map('n', 'gt', 'lua require("telescope.builtin").lsp_type_definitions()', opts) map('n', 'gr', 'lua require("telescope.builtin").lsp_references()', opts) map('n', 'gn', 'lua require("cosmic.core.theme.ui").rename()', opts) -- diagnostics -map('n', '[g', 'lua vim.diagnostic.goto_prev({ float = { show_header = false }})', opts) -map('n', ']g', 'lua vim.diagnostic.goto_next({ float = { show_header = false }})', opts) +map('n', '[g', 'lua vim.diagnostic.goto_prev()', opts) +map('n', ']g', 'lua vim.diagnostic.goto_next()', opts) map('n', 'ge', 'lua vim.diagnostic.open_float(0, { scope = "line", })', opts) -map('n', 'ge', ':telescope lsp_document_diagnostics', opts) +map('n', 'ge', 'lua require("telescope.builtin").lsp_document_diagnostics()', opts) map('n', 'K', 'lua vim.lsp.buf.hover()', opts) map('n', 'ga', 'lua require("telescope.builtin").lsp_code_actions()', opts) map('v', 'ga', 'lua require("telescope.builtin").lsp_range_code_actions()', opts)