diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 51bc17b..ee81770 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -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 - 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', '', vim.lsp.buf.signature_help, opts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) - vim.keymap.set('n', 'f', function() - vim.lsp.buf.format { async = true } - end, opts) - end, -}) - -vim.keymap.set('n', '', ':move -2' ) -vim.keymap.set('n', '', ':move -2' ) -vim.keymap.set('n', '', ':move +1' ) -vim.keymap.set('n', '', ':move +1' ) +vim.keymap.set('n', '', ':move -2') +vim.keymap.set('n', '', ':move -2') +vim.keymap.set('n', '', ':move +1') +vim.keymap.set('n', '', ':move +1') 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 🏕️") diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..a2e2668 --- /dev/null +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,13 @@ +return { { + "catppuccin/nvim", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", + integrations = { + treesitter = false, + }, + }) + vim.cmd.colorscheme("catppuccin") + end +} } diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..f8152e7 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,58 @@ +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + 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', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', '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 +} diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..42e79e4 --- /dev/null +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -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, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..210677f --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -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 +}