Add a few custom plugins and mappings

This commit is contained in:
Levente Krizsán 2024-08-27 21:35:31 +02:00
parent a22976111e
commit 51b1a17ea8
6 changed files with 115 additions and 13 deletions

View File

@ -190,6 +190,9 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<leader>v', ':vsplit<CR>', { noremap = true, silent = true, desc = 'Create vertical split' })
vim.keymap.set('n', '<leader>h', ':split<CR>', { noremap = true, silent = true, desc = 'Create horizontal split' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -608,14 +611,28 @@ require('lazy').setup({
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
tsserver = {
-- https://github.com/neovim/nvim-lspconfig/issues/2688#issuecomment-1601582648
init_options = {
preferences = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
importModuleSpecifierPreference = 'non-relative',
},
},
},
--
lua_ls = {
@ -647,6 +664,7 @@ require('lazy').setup({
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
'prettierd',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
@ -703,7 +721,12 @@ require('lazy').setup({
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
javascript = { 'prettierd', 'prettier', stop_after_first = true },
javascriptreact = { 'prettierd', 'prettier', stop_after_first = true },
typescript = { 'prettierd', 'prettier', stop_after_first = true },
typescriptreact = { 'prettierd', 'prettier', stop_after_first = true },
rust = { 'rustfmt' },
},
},
},
@ -728,12 +751,12 @@ require('lazy').setup({
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
},
'saadparwaiz1/cmp_luasnip',
@ -888,7 +911,7 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'regex' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
@ -920,8 +943,8 @@ require('lazy').setup({
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
@ -929,7 +952,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the

View File

@ -0,0 +1,10 @@
-- https://github.com/ray-x/lsp_signature.nvim
return {
'ray-x/lsp_signature.nvim',
event = 'VeryLazy',
opts = {},
config = function(_, opts)
require('lsp_signature').setup(opts)
vim.keymap.set('i', '<C-g>', vim.lsp.buf.signature_help, { silent = true, noremap = true, desc = 'toggle function signature' })
end,
}

View File

@ -0,0 +1,39 @@
return {
'folke/noice.nvim',
event = 'VeryLazy',
opts = {
-- add any options here
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
'MunifTanjim/nui.nvim',
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
'rcarriga/nvim-notify',
},
config = function()
require('noice').setup {
lsp = {
-- need to disable this because of `lsp-signature`
signature = {
enabled = false,
},
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
}
end,
}

View File

@ -0,0 +1,6 @@
-- https://github.com/windwp/nvim-ts-autotag
return {
'windwp/nvim-ts-autotag',
opts = {},
event = 'VeryLazy',
}

View File

@ -0,0 +1,18 @@
return {
'christoomey/vim-tmux-navigator',
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
},
keys = {
{ '<c-h>', '<cmd>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd>TmuxNavigatePrevious<cr>' },
},
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,6 @@
-- https://github.com/folke/ts-comments.nvim
return {
'folke/ts-comments.nvim',
opts = {},
event = 'VeryLazy',
}