diff --git a/after/plugin/keymaps.lua b/after/plugin/keymaps.lua index 17673bcc..9b1902ff 100644 --- a/after/plugin/keymaps.lua +++ b/after/plugin/keymaps.lua @@ -55,6 +55,9 @@ keymap("n", "ch", "silent !tmux neww tmux-cht.sh", { desc = "[C -- replace selected word in the file keymap("n", "R", [[:%s/\<\>//gI]], { desc = "[R]eplace words in the file" }) +-- delete line with selected in the file +keymap("n", "dl", [[:g/\<\>/d]], + { desc = "[D]elete [L]ine with selected word in the file" }) -- Make file executable keymap("n", "x", "!chmod +x %", { silent = true, desc = "Make [X]ecutable file" }) diff --git a/after/plugin/lspkind.lua b/after/plugin/lspkind.lua new file mode 100644 index 00000000..99524b2c --- /dev/null +++ b/after/plugin/lspkind.lua @@ -0,0 +1,47 @@ +require('lspkind').init({ + -- DEPRECATED (use mode instead): enables text annotations + -- + -- default: true + -- with_text = true, + + -- defines how annotations are shown + -- default: symbol + -- options: 'text', 'text_symbol', 'symbol_text', 'symbol' + mode = 'symbol_text', + -- default symbol map + -- can be either 'default' (requires nerd-fonts font) or + -- 'codicons' for codicon preset (requires vscode-codicons font) + -- + -- default: 'default' + preset = 'codicons', + -- override preset symbols + -- + -- default: {} + symbol_map = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "ﰠ", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "塞", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + TypeParameter = "" + }, +}) diff --git a/init.lua b/init.lua index 1d805164..da694988 100644 --- a/init.lua +++ b/init.lua @@ -186,7 +186,7 @@ require('lazy').setup({ end, }, - { + { "glepnir/lspsaga.nvim", event = "LspAttach", dependencies = { @@ -195,10 +195,18 @@ require('lazy').setup({ { "nvim-treesitter/nvim-treesitter" } }, config = function() - require("lspsaga").setup({}) + require("lspsaga").setup { + lightbulb = { + enable = false + }, + request_timeout = 5000 + } end, }, + { "onsails/lspkind.nvim" }, + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. @@ -315,7 +323,8 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim', 'markdown', 'markdown_inline' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim', 'markdown', + 'markdown_inline' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = true, @@ -433,9 +442,13 @@ local on_attach = function(_, bufnr) print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, '[W]orkspace [L]ist Folders') - -- Toggle outline - nkeymap("o", ":Lspsaga outline", '[O]utline') + nmap("o", ":Lspsaga outline", '[O]utline') + + -- Show cursor diagnostic + -- nmap("", ":Lspsaga show_cursor_diagnostics", 'Show cursor diagnostics') + nmap("", ":Lspsaga show_line_diagnostics", 'Show cursor diagnostics') + -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) @@ -454,7 +467,18 @@ local servers = { -- pyright = {}, -- rust_analyzer = {}, -- tsserver = {}, - + efm = { + init_options = { documentFormatting = true }, + settings = { + rootMarkers = { ".git/" }, + languages = { + prettier = { + formatCommand = 'prettierd "${INPUT}"', + formatStdin = true, + } + } + } + }, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -493,6 +517,7 @@ mason_lspconfig.setup_handlers { -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' +local lspkind = require 'lspkind' luasnip.config.setup {} @@ -534,6 +559,11 @@ cmp.setup { { name = 'luasnip' }, { name = 'buffer' }, }, + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + }) + } } -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/null-ls.lua b/lua/custom/plugins/null-ls.lua deleted file mode 100644 index 32e6d34c..00000000 --- a/lua/custom/plugins/null-ls.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - "jose-elias-alvarez/null-ls.nvim", - config = function() - local null_ls = require("null-ls") - null_ls.setup({ - source = { - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.completion.spell, - } - }) - end -} diff --git a/lua/custom/plugins/todo.lua b/lua/custom/plugins/todo.lua new file mode 100644 index 00000000..94d7c148 --- /dev/null +++ b/lua/custom/plugins/todo.lua @@ -0,0 +1,7 @@ +return { + "folke/todo-comments.nvim", + requires = "nvim-lua/plenary.nvim", + config = function() + require("todo-comments").setup() + end +} diff --git a/lua/custom/plugins/ts-autotag.lua b/lua/custom/plugins/ts-autotag.lua new file mode 100644 index 00000000..4d6b9a31 --- /dev/null +++ b/lua/custom/plugins/ts-autotag.lua @@ -0,0 +1,6 @@ +return { + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup() + end +}