nvim: moved independent plugins into their own files
This commit is contained in:
parent
710d980756
commit
5b79141699
|
@ -14,91 +14,17 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup({
|
||||
"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,
|
||||
},
|
||||
})
|
||||
require('lazy').setup({ { import = "plugins" } })
|
||||
|
||||
--[[
|
||||
Potential plugins to integrate:
|
||||
- https://github.com/fedepujol/move.nvim
|
||||
]]--
|
||||
]]
|
||||
|
||||
require('catppuccin').setup({
|
||||
flavour = "mocha",
|
||||
integrations = {
|
||||
treesitter = false,
|
||||
},
|
||||
})
|
||||
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.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.relativenumber = true
|
||||
|
@ -111,6 +37,6 @@ vim.opt.tabstop = 4
|
|||
vim.opt.softtabstop = vim.opt.tabstop:get()
|
||||
vim.opt.shiftwidth = 4
|
||||
|
||||
vim.opt.fillchars:append({ eob = ' '})
|
||||
vim.opt.fillchars:append({ eob = ' ' })
|
||||
|
||||
vim.notify("starting nvim 🏕️")
|
||||
|
|
13
.config/nvim/lua/plugins/catppuccin.lua
Normal file
13
.config/nvim/lua/plugins/catppuccin.lua
Normal 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
|
||||
} }
|
58
.config/nvim/lua/plugins/lsp.lua
Normal file
58
.config/nvim/lua/plugins/lsp.lua
Normal 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
|
||||
}
|
21
.config/nvim/lua/plugins/neo-tree.lua
Normal file
21
.config/nvim/lua/plugins/neo-tree.lua
Normal 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,
|
||||
}
|
16
.config/nvim/lua/plugins/treesitter.lua
Normal file
16
.config/nvim/lua/plugins/treesitter.lua
Normal 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
|
||||
}
|
Loading…
Reference in a new issue