nvim: moved independent plugins into their own files

This commit is contained in:
kalmenn 2023-12-17 17:35:57 +01:00
parent 710d980756
commit 5b79141699
Signed by: kalmenn
GPG key ID: DFF253360BF8471F
5 changed files with 115 additions and 81 deletions

View file

@ -14,91 +14,17 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require('lazy').setup({ require('lazy').setup({ { import = "plugins" } })
"catppuccin/nvim",
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
config = function ()
require('neo-tree').setup({
filesystem = {
filtered_items = {
visible = true,
},
},
})
end,
},
})
--[[ --[[
Potential plugins to integrate: Potential plugins to integrate:
- https://github.com/fedepujol/move.nvim - https://github.com/fedepujol/move.nvim
]]-- ]]
require('catppuccin').setup({ vim.keymap.set('n', '<A-k>', ':move -2<CR>')
flavour = "mocha", vim.keymap.set('n', '<A-up>', ':move -2<CR>')
integrations = { vim.keymap.set('n', '<A-j>', ':move +1<CR>')
treesitter = false, vim.keymap.set('n', '<A-down>', ':move +1<CR>')
},
})
vim.cmd.colorscheme("catppuccin")
require('nvim-treesitter.configs').setup {
ensure_installed = { "lua", "rust" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
local lspconfig = require('lspconfig')
lspconfig.pyright.setup {}
lspconfig.rust_analyzer.setup {}
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
vim.keymap.set('n', '<A-k>', ':move -2<CR>' )
vim.keymap.set('n', '<A-up>', ':move -2<CR>' )
vim.keymap.set('n', '<A-j>', ':move +1<CR>' )
vim.keymap.set('n', '<A-down>', ':move +1<CR>' )
vim.o.number = true vim.o.number = true
vim.o.relativenumber = true vim.o.relativenumber = true
@ -111,6 +37,6 @@ vim.opt.tabstop = 4
vim.opt.softtabstop = vim.opt.tabstop:get() vim.opt.softtabstop = vim.opt.tabstop:get()
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
vim.opt.fillchars:append({ eob = ' '}) vim.opt.fillchars:append({ eob = ' ' })
vim.notify("starting nvim 🏕️") vim.notify("starting nvim 🏕️")

View file

@ -0,0 +1,13 @@
return { {
"catppuccin/nvim",
priority = 1000,
config = function()
require("catppuccin").setup({
flavour = "mocha",
integrations = {
treesitter = false,
},
})
vim.cmd.colorscheme("catppuccin")
end
} }

View file

@ -0,0 +1,58 @@
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
return {
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({})
lspconfig.rust_analyzer.setup({})
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
end
}

View file

@ -0,0 +1,21 @@
-- TODO: set keymaps
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
config = function()
require('neo-tree').setup({
filesystem = {
filtered_items = {
visible = true,
},
},
})
end,
}

View file

@ -0,0 +1,16 @@
return {
"nvim-treesitter/nvim-treesitter",
config = function()
require('nvim-treesitter.configs').setup({
modules = {},
ensure_installed = { "lua", "rust" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
ignore_install = {},
})
end
}