Add keymap to delete line with selected word in the file and configure lspkind symbols
This commit is contained in:
parent
ef91f14af8
commit
a9de446ed3
|
@ -55,6 +55,9 @@ keymap("n", "<leader>ch", "<cmd>silent !tmux neww tmux-cht.sh<CR>", { desc = "[C
|
|||
|
||||
-- replace selected word in the file
|
||||
keymap("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = "[R]eplace words in the file" })
|
||||
-- delete line with selected in the file
|
||||
keymap("n", "<leader>dl", [[:g/\<<C-r><C-w>\>/d]],
|
||||
{ desc = "[D]elete [L]ine with selected word in the file" })
|
||||
|
||||
-- Make file executable
|
||||
keymap("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Make [X]ecutable file" })
|
||||
|
|
|
@ -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 = ""
|
||||
},
|
||||
})
|
40
init.lua
40
init.lua
|
@ -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', '<leader>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("<leader>o", ":Lspsaga outline<CR>", '[O]utline')
|
||||
nmap("<leader>o", ":Lspsaga outline<CR>", '[O]utline')
|
||||
|
||||
-- Show cursor diagnostic
|
||||
-- nmap("<S-f>", ":Lspsaga show_cursor_diagnostics<CR>", 'Show cursor diagnostics')
|
||||
nmap("<S-f>", ":Lspsaga show_line_diagnostics<CR>", '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`
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"windwp/nvim-ts-autotag",
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
end
|
||||
}
|
Loading…
Reference in New Issue