From 897151daf9a8c7504108410ed37cd0e4d540d3b6 Mon Sep 17 00:00:00 2001 From: h3n3 Date: Sun, 28 Jan 2024 16:36:57 +0100 Subject: [PATCH] neovim setup --- .luacheckrc | 14 ++ .luarc.json | 8 + README.md | 12 ++ init.lua | 1 + lazy-lock.json | 47 ++++++ lua/config/autocmds.lua | 23 +++ lua/config/globals.lua | 2 + lua/config/init.lua | 46 ++++++ lua/config/keymaps.lua | 58 +++++++ lua/config/options.lua | 50 ++++++ lua/plugins/comment.lua | 14 ++ lua/plugins/copilot.lua | 56 +++++++ lua/plugins/gitsigns-nvim.lua | 7 + lua/plugins/hardtime-nvim.lua | 10 ++ lua/plugins/indent-blankline.lua | 6 + lua/plugins/init.lua | 4 + lua/plugins/leap-nvim.lua | 7 + lua/plugins/lspsaga-nvim.lua | 21 +++ lua/plugins/lualine-nvim.lua | 24 +++ lua/plugins/mason-lspconfig.lua | 23 +++ lua/plugins/mason.lua | 14 ++ lua/plugins/neorg.lua | 26 ++++ lua/plugins/nightfox.lua | 8 + lua/plugins/noice.lua | 43 ++++++ lua/plugins/nvim-autopairs.lua | 5 + lua/plugins/nvim-cmp.lua | 54 +++++++ lua/plugins/nvim-dap-python.lua | 11 ++ lua/plugins/nvim-dap.lua | 39 +++++ lua/plugins/nvim-lspconfig.lua | 202 +++++++++++++++++++++++++ lua/plugins/nvim-tree.lua | 14 ++ lua/plugins/nvim-treesitter.lua | 55 +++++++ lua/plugins/nvim-ts-autotag.lua | 4 + lua/plugins/nvim-web-devicons.lua | 3 + lua/plugins/rust-tools-nvim.lua | 22 +++ lua/plugins/tailwind-colorizer-cmp.lua | 9 ++ lua/plugins/telescope.lua | 45 ++++++ lua/plugins/theme.lua | 10 ++ lua/plugins/tmux-navigator.lua | 4 + lua/plugins/trouble-nvim.lua | 37 +++++ lua/plugins/true-zen.lua | 4 + lua/plugins/vim-fugitive.lua | 4 + lua/plugins/vim-highlightedyank.lua | 4 + lua/plugins/vim-illuminate.lua | 7 + lua/plugins/whichkey.lua | 5 + lua/util/icons.lua | 18 +++ lua/util/keymapper.lua | 69 +++++++++ lua/util/lsp.lua | 27 ++++ neoconf.json | 15 ++ 48 files changed, 1191 insertions(+) create mode 100644 .luacheckrc create mode 100644 .luarc.json create mode 100644 README.md create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/config/autocmds.lua create mode 100644 lua/config/globals.lua create mode 100644 lua/config/init.lua create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/options.lua create mode 100644 lua/plugins/comment.lua create mode 100644 lua/plugins/copilot.lua create mode 100644 lua/plugins/gitsigns-nvim.lua create mode 100644 lua/plugins/hardtime-nvim.lua create mode 100644 lua/plugins/indent-blankline.lua create mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/leap-nvim.lua create mode 100644 lua/plugins/lspsaga-nvim.lua create mode 100644 lua/plugins/lualine-nvim.lua create mode 100644 lua/plugins/mason-lspconfig.lua create mode 100644 lua/plugins/mason.lua create mode 100644 lua/plugins/neorg.lua create mode 100644 lua/plugins/nightfox.lua create mode 100644 lua/plugins/noice.lua create mode 100644 lua/plugins/nvim-autopairs.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/nvim-dap-python.lua create mode 100644 lua/plugins/nvim-dap.lua create mode 100644 lua/plugins/nvim-lspconfig.lua create mode 100644 lua/plugins/nvim-tree.lua create mode 100644 lua/plugins/nvim-treesitter.lua create mode 100644 lua/plugins/nvim-ts-autotag.lua create mode 100644 lua/plugins/nvim-web-devicons.lua create mode 100644 lua/plugins/rust-tools-nvim.lua create mode 100644 lua/plugins/tailwind-colorizer-cmp.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/theme.lua create mode 100644 lua/plugins/tmux-navigator.lua create mode 100644 lua/plugins/trouble-nvim.lua create mode 100644 lua/plugins/true-zen.lua create mode 100644 lua/plugins/vim-fugitive.lua create mode 100644 lua/plugins/vim-highlightedyank.lua create mode 100644 lua/plugins/vim-illuminate.lua create mode 100644 lua/plugins/whichkey.lua create mode 100644 lua/util/icons.lua create mode 100644 lua/util/keymapper.lua create mode 100644 lua/util/lsp.lua create mode 100644 neoconf.json diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..a527f76 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,14 @@ +---@diagnostic disable: lowercase-global + +ignore = { + "111", -- setting non-standard global variable + "212/_.*", -- unused argument, for vars with "_" prefix + "214", -- used variable with unused hint ("_" prefix) + "121", -- setting read-only global variable 'vim' + "122", -- setting read-only field of global variable 'vim' +} + +-- Global objects defined by the C code +read_globals = { + "vim", +} diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..d501a63 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,8 @@ +{ + "diagnostics.globals": [ + "vim" + ], + "diagnostics.disable": [ + "different-requires" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..760e533 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# nvim installatie uitbreidingen + +### Links + +[Video](https://youtu.be/ZjMzBd1Dqz8) die als leidraad werd gebruikt voor mijn installatie. +De [github](https://github.com/radleylewis/nvim) site die er bij hoort. + +### Inleiding + +Zoekende naar een bevredigende oplossing om python te programmeren in Neovim heb ik bovenstaande video als leidraad genomen om mijn Neovim als IDE in te stellen. +In principe kwam het er op neer dat ik de video heb bekeken en de instellingen van hem heb gekopieerd. + diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b3fe4e3 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require('config') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..408b7c8 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,47 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, + "copilot.lua": { "branch": "master", "commit": "b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf" }, + "efmls-configs-nvim": { "branch": "main", "commit": "5372981bc8785facefb51cd50cb0888d1129a291" }, + "gitsigns.nvim": { "branch": "main", "commit": "300a306da9973e81c2c06460f71fd7a079df1f36" }, + "hardtime.nvim": { "branch": "main", "commit": "4ba3be553fa0b713c7b817f6d201b07d282accf3" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "leap.nvim": { "branch": "main", "commit": "9f7cf0a87ca2c3f47df37ef6787d34a65604d248" }, + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lspsaga.nvim": { "branch": "main", "commit": "2198c07124bef27ef81335be511c8abfd75db933" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" }, + "neoconf.nvim": { "branch": "main", "commit": "cfc29315288515849aa54c05828d49f01f033b66" }, + "neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" }, + "neorg": { "branch": "main", "commit": "28cbafbc0cde316d8e2618ff26377200225e9393" }, + "nightfox.nvim": { "branch": "main", "commit": "a4bc2bd3d7ff1770ae104068458d3b0b8f8ec00d" }, + "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, + "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, + "nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, + "nvim-dap-python": { "branch": "master", "commit": "091e4ae00a12085f9ed4200a3cd04af7179b8a23" }, + "nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, + "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, + "nvim-tree.lua": { "branch": "master", "commit": "7bdb220d0fe604a77361e92cdbc7af1b8a412126" }, + "nvim-treesitter": { "branch": "master", "commit": "cd4e0909948eb33d3959e133c16f837e4db122c6" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, + "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, + "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, + "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, + "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "bc25c56083939f274edcfe395c6ff7de23b67c50" }, + "telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "theme": { "branch": "main", "commit": "bc1f2151f23227ba02ac203c2c59ad693352a741" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "true-zen.nvim": { "branch": "main", "commit": "2b9e210e0d1a735e1fa85ec22190115dffd963aa" }, + "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, + "vim-highlightedyank": { "branch": "master", "commit": "fa3f57b097e9521ce41a66b6c7cf5d9adea70ea3" }, + "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, + "vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..8bd359d --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,23 @@ +-- auto-format on save +local lsp_fmt_group = vim.api.nvim_create_augroup("LspFormattingGroup", {}) +vim.api.nvim_create_autocmd("BufWritePre", { + group = lsp_fmt_group, + callback = function() + local efm = vim.lsp.get_active_clients({ name = "efm" }) + + if vim.tbl_isempty(efm) then + return + end + + vim.lsp.buf.format({ name = "efm", async = true }) + end, +}) + +-- highlight on yank +local highlight_yank_group = vim.api.nvim_create_augroup("HighlightYankGroup", {}) +vim.api.nvim_create_autocmd("TextYankPost", { + group = highlight_yank_group, + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/lua/config/globals.lua b/lua/config/globals.lua new file mode 100644 index 0000000..6ef2cd8 --- /dev/null +++ b/lua/config/globals.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100644 index 0000000..1136226 --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,46 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require('config.globals') +require('config.options') +require('config.keymaps') +require('config.autocmds') + +local plugins = "plugins" + +local opts = { + defaults = { + lazy = true, + }, + install = { + colorscheme = { "catppuccin" } + }, + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "netrw", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + change_detection = { + notify = false, + }, +} + +require("lazy").setup('plugins', opts) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..797e6fb --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,58 @@ +local mapkey = require("util.keymapper").mapvimkey + +-- Buffer Navigation +mapkey("bn", "bnext", "n") -- Next buffer +mapkey("bp", "bprevious", "n") -- Prev buffer +mapkey("bb", "e #", "n") -- Switch to Other Buffer +mapkey("`", "e #", "n") -- Switch to Other Buffer + +-- Directory Navigation +mapkey("m", "NvimTreeFocus", "n") +mapkey("e", "NvimTreeToggle", "n") + +-- Pane and Window Navigation +mapkey("", "h", "n") -- Navigate Left +mapkey("", "j", "n") -- Navigate Down +mapkey("", "k", "n") -- Navigate Up +mapkey("", "l", "n") -- Navigate Right +mapkey("", "wincmd h", "t") -- Navigate Left +mapkey("", "wincmd j", "t") -- Navigate Down +mapkey("", "wincmd k", "t") -- Navigate Up +mapkey("", "wincmd l", "t") -- Navigate Right +mapkey("", "TmuxNavigateLeft", "n") -- Navigate Left +mapkey("", "TmuxNavigateDown", "n") -- Navigate Down +mapkey("", "TmuxNavigateUp", "n") -- Navigate Up +mapkey("", "TmuxNavigateRight", "n") -- Navigate Right + +-- Window Management +mapkey("sv", "vsplit", "n") -- Split Vertically +mapkey("sh", "split", "n") -- Split Horizontally +mapkey("", "resize +2", "n") +mapkey("", "resize -2", "n") +mapkey("", "vertical resize +2", "n") +mapkey("", "vertical resize -2", "n") + +-- Show Full File-Path +mapkey("pa", "echo expand('%:p')", "n") -- Show Full File Path + +-- Notes +mapkey("ng", "Neorg workspace general", "n") +mapkey("nw", "Neorg workspace work", "n") +mapkey("ny", "Neorg workspace youtube", "n") + +-- Indenting +vim.keymap.set("v", "<", "", ">gv", { silent = true, noremap = true }) + +local api = vim.api + +-- Zen Mode +api.nvim_set_keymap("n", "zn", ":TZNarrow", {}) +api.nvim_set_keymap("v", "zn", ":'<,'>TZNarrow", {}) +api.nvim_set_keymap("n", "sm", ":TZFocus", {}) +api.nvim_set_keymap("n", "zm", ":TZMinimalist", {}) +api.nvim_set_keymap("n", "za", ":TZAtaraxis", {}) + +-- Comments +api.nvim_set_keymap("n", "", "gtc", { noremap = false }) +api.nvim_set_keymap("v", "", "goc", { noremap = false }) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..ddb1b4d --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,50 @@ +local opt = vim.opt + +-- Tab / Indentation +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.softtabstop = 2 +opt.expandtab = true +opt.smartindent = true +opt.wrap = false + +-- Search +opt.incsearch = true +opt.ignorecase = true +opt.smartcase = true +opt.hlsearch = false + +-- Appearance +opt.number = true +opt.relativenumber = true +opt.termguicolors = true +opt.colorcolumn = '100' +opt.signcolumn = 'yes' +opt.cmdheight = 1 +opt.scrolloff = 10 +opt.completeopt = "menuone,noinsert,noselect" + +-- Behaviour +opt.hidden = true +opt.errorbells = false +opt.swapfile = false +opt.backup = false +opt.undodir = vim.fn.expand("~/.vim/undodir") +opt.undofile = true +opt.backspace = "indent,eol,start" +opt.splitright = true +opt.splitbelow = true +opt.autochdir = false +opt.iskeyword:append("-") +opt.selection = "exclusive" +opt.mouse = "a" +opt.clipboard:append("unnamedplus") +opt.modifiable = true +opt.guicursor = "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175" +opt.encoding = "UTF-8" +opt.showmode = false + +-- folds +opt.foldmethod = "expr" +opt.foldexpr = "nvim_treesiter#foldexpr()" +opt.foldlevel = 99 diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..ee288f9 --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,14 @@ +return { + "numToStr/Comment.nvim", + opts = { + toggler = { + line = "gtc", + block = "gtb", + }, + opleader = { + line = "goc", + block = "gob", + }, + }, + lazy = false, +} diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua new file mode 100644 index 0000000..ed44383 --- /dev/null +++ b/lua/plugins/copilot.lua @@ -0,0 +1,56 @@ +return { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + dependencies = "zbirenbaum/copilot-cmp", + config = function() + require("copilot").setup(require("copilot").setup({ + panel = { + enabled = true, + auto_refresh = false, + keymap = { + jump_prev = "[[", + jump_next = "]]", + accept = "", + refresh = "gr", + open = "", + }, + layout = { + position = "bottom", -- | top | left | right + ratio = 0.4, + }, + }, + suggestion = { + enabled = true, + auto_trigger = true, + debounce = 75, + keymap = { + accept = "", + accept_word = false, + accept_line = false, + next = "", + prev = "", + dismiss = "", + }, + }, + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["."] = false, + }, + copilot_node_command = "node", -- Node.js version must be > 16.x + server_opts_overrides = {}, + })) + require("copilot_cmp").setup({ + formatters = { + insert_text = require("copilot_cmp.format").remove_existing, + }, + }) + end, +} diff --git a/lua/plugins/gitsigns-nvim.lua b/lua/plugins/gitsigns-nvim.lua new file mode 100644 index 0000000..be4cd63 --- /dev/null +++ b/lua/plugins/gitsigns-nvim.lua @@ -0,0 +1,7 @@ +return { + "lewis6991/gitsigns.nvim", + lazy = false, + config = function() + require("gitsigns").setup() + end +} diff --git a/lua/plugins/hardtime-nvim.lua b/lua/plugins/hardtime-nvim.lua new file mode 100644 index 0000000..af3f9ad --- /dev/null +++ b/lua/plugins/hardtime-nvim.lua @@ -0,0 +1,10 @@ +return { + "m4xshen/hardtime.nvim", + command = "Hardtime", + event = "BufEnter", + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + }, + opts = {}, +} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..e33c078 --- /dev/null +++ b/lua/plugins/indent-blankline.lua @@ -0,0 +1,6 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + lazy = false, + opts = {}, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..cfbdc56 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,4 @@ +return { + { "folke/neoconf.nvim", cmd = "Neoconf" }, + "folke/neodev.nvim", +} diff --git a/lua/plugins/leap-nvim.lua b/lua/plugins/leap-nvim.lua new file mode 100644 index 0000000..95a8b1e --- /dev/null +++ b/lua/plugins/leap-nvim.lua @@ -0,0 +1,7 @@ +return { + "ggandor/leap.nvim", + event = "BufEnter", + config = function() + require("leap").add_default_mappings() + end, +} diff --git a/lua/plugins/lspsaga-nvim.lua b/lua/plugins/lspsaga-nvim.lua new file mode 100644 index 0000000..e54132c --- /dev/null +++ b/lua/plugins/lspsaga-nvim.lua @@ -0,0 +1,21 @@ +return { + "glepnir/lspsaga.nvim", + lazy = false, + config = function() + require("lspsaga").setup({ + -- keybinds for navigation in lspsaga window + move_in_saga = { prev = "", next = "" }, + -- use enter to open file with finder + finder_action_keys = { + open = "", + }, + -- use enter to open file with definition preview + definition_action_keys = { + edit = "", + }, + }) + end, + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, +} diff --git a/lua/plugins/lualine-nvim.lua b/lua/plugins/lualine-nvim.lua new file mode 100644 index 0000000..4472127 --- /dev/null +++ b/lua/plugins/lualine-nvim.lua @@ -0,0 +1,24 @@ +local config = function() + require("lualine").setup({ + options = { + theme = "auto", + globalstatus = true, + component_separators = { left = "|", right = "|" }, + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "buffers" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + tabline = {}, + }) +end + +return { + "nvim-lualine/lualine.nvim", + lazy = false, + config = config, +} diff --git a/lua/plugins/mason-lspconfig.lua b/lua/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..4f6b4d0 --- /dev/null +++ b/lua/plugins/mason-lspconfig.lua @@ -0,0 +1,23 @@ +local opts = { + ensure_installed = { + "efm", + "bashls", + "tsserver", + "solidity", + "tailwindcss", + "pyright", + "lua_ls", + "emmet_ls", + "jsonls", + "clangd", + }, + + automatic_installation = true, +} + +return { + "williamboman/mason-lspconfig.nvim", + opts = opts, + event = "BufReadPre", + dependencies = "williamboman/mason.nvim", +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..789d28a --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,14 @@ +return { + "williamboman/mason.nvim", + cmd = "Mason", + event = "BufReadPre", + opts = { + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }, +} diff --git a/lua/plugins/neorg.lua b/lua/plugins/neorg.lua new file mode 100644 index 0000000..56ae52d --- /dev/null +++ b/lua/plugins/neorg.lua @@ -0,0 +1,26 @@ +return { + { + "nvim-neorg/neorg", + build = ":Neorg sync-parsers", + dependencies = { "nvim-lua/plenary.nvim" }, + lazy = false, + config = function() + require("neorg").setup({ + load = { + ["core.defaults"] = {}, -- Loads default behaviour + ["core.concealer"] = {}, -- Adds pretty icons to your documents + ["core.dirman"] = { -- Manages Neorg workspaces + config = { + workspaces = { + general = "~/Documents/Notes/general", + work = "~/Documents/Notes/work", + youtube = "~/Documents/Notes/youtube", + }, + default_workspace = "general", + }, + }, + }, + }) + end, + }, +} diff --git a/lua/plugins/nightfox.lua b/lua/plugins/nightfox.lua new file mode 100644 index 0000000..d91a5db --- /dev/null +++ b/lua/plugins/nightfox.lua @@ -0,0 +1,8 @@ +return { + "EdenEast/nightfox.nvim", + lazy = false, + priority = 999, + config = function() + vim.cmd('colorscheme nightfox') + end +} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..3b110b0 --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,43 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + routes = { + { + view = "notify", + filter = { event = "msg_showmode" }, + }, + }, + lsp = { + -- 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, + }, + }, + -- 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 + }, + }, + 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("notify").setup({ + -- background_colour = "#000000", + -- }) + -- end, + -- }, + }, +} diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..2355082 --- /dev/null +++ b/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, -- this is equalent to setup({}) function +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..94afba3 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,54 @@ +return { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") + + require("luasnip/loaders/from_vscode").lazy_load() + + vim.opt.completeopt = "menu,menuone,noselect" + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- lsp + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + -- configure lspkind for vs-code like icons + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) + end, + dependencies = { + "onsails/lspkind.nvim", + { + + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + }, +} diff --git a/lua/plugins/nvim-dap-python.lua b/lua/plugins/nvim-dap-python.lua new file mode 100644 index 0000000..5faf8ba --- /dev/null +++ b/lua/plugins/nvim-dap-python.lua @@ -0,0 +1,11 @@ +return { + "mfussenegger/nvim-dap-python", + ft = "python", -- filetype + config = function() + require("dap-python").setup("~/.local/share/nvim/mason/packages/debugpy/venv/bin/python") + end, + dependencies = { + "mfussenegger/nvim-dap", + "rcarriga/nvim-dap-ui", + }, +} diff --git a/lua/plugins/nvim-dap.lua b/lua/plugins/nvim-dap.lua new file mode 100644 index 0000000..7854977 --- /dev/null +++ b/lua/plugins/nvim-dap.lua @@ -0,0 +1,39 @@ +local debugging_signs = require("util.icons").debugging_signs + +return { + "mfussenegger/nvim-dap", + config = function() + local dap = require("dap") + local dapui = require("dapui") + + -- set custom icons + for name, sign in pairs(debugging_signs) do + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) + end + + -- setup dap + dapui.setup() + + -- add event listeners + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + vim.cmd("Hardtime disable") + vim.cmd("NvimTreeClose") + end + + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + vim.cmd("Hardtime enable") + end + + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + vim.cmd("Hardtime enable") + end + end, + dependencies = "rcarriga/nvim-dap-ui", +} diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..07e62d9 --- /dev/null +++ b/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,202 @@ +local on_attach = require("util.lsp").on_attach +local diagnostic_signs = require("util.icons").diagnostic_signs + +local config = function() + require("neoconf").setup({}) + local cmp_nvim_lsp = require("cmp_nvim_lsp") + local lspconfig = require("lspconfig") + local capabilities = cmp_nvim_lsp.default_capabilities() + + for type, icon in pairs(diagnostic_signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- lua + lspconfig.lua_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + + -- json + lspconfig.jsonls.setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "json", "jsonc" }, + }) + + -- python + lspconfig.pyright.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + pyright = { + disableOrganizeImports = false, + analysis = { + useLibraryCodeForTypes = true, + autoSearchPaths = true, + diagnosticMode = "workspace", + autoImportCompletions = true, + }, + }, + }, + }) + + -- typescript + lspconfig.tsserver.setup({ + on_attach = on_attach, + capabilities = capabilities, + filetypes = { + "typescript", + "javascript", + "typescriptreact", + "javascriptreact", + }, + root_dir = lspconfig.util.root_pattern("package.json", "tsconfig.json", ".git"), + }) + + -- bash + lspconfig.bashls.setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "sh", "aliasrc" }, + }) + + -- solidity + lspconfig.solidity.setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "solidity" }, + }) + + -- typescriptreact, javascriptreact, css, sass, scss, less, svelte, vue + lspconfig.emmet_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { + "typescriptreact", + "javascriptreact", + "javascript", + "css", + "sass", + "scss", + "less", + "svelte", + "vue", + "html", + }, + }) + + -- docker + lspconfig.dockerls.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- C/C++ + lspconfig.clangd.setup({ + capabilities = capabilities, + on_attach = on_attach, + cmd = { + "clangd", + "--offset-encoding=utf-16", + }, + }) + + local luacheck = require("efmls-configs.linters.luacheck") + local stylua = require("efmls-configs.formatters.stylua") + local flake8 = require("efmls-configs.linters.flake8") + local black = require("efmls-configs.formatters.black") + local eslint = require("efmls-configs.linters.eslint") + local prettier_d = require("efmls-configs.formatters.prettier_d") + local fixjson = require("efmls-configs.formatters.fixjson") + local shellcheck = require("efmls-configs.linters.shellcheck") + local shfmt = require("efmls-configs.formatters.shfmt") + local hadolint = require("efmls-configs.linters.hadolint") + local solhint = require("efmls-configs.linters.solhint") + local cpplint = require("efmls-configs.linters.cpplint") + local clangformat = require("efmls-configs.formatters.clang_format") + + -- configure efm server + lspconfig.efm.setup({ + filetypes = { + "lua", + "python", + "json", + "jsonc", + "sh", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "svelte", + "vue", + "markdown", + "docker", + "solidity", + "html", + "css", + "c", + "cpp", + }, + init_options = { + documentFormatting = true, + documentRangeFormatting = true, + hover = true, + documentSymbol = true, + codeAction = true, + completion = true, + }, + settings = { + languages = { + lua = { luacheck, stylua }, + python = { flake8, black }, + typescript = { eslint, prettier_d }, + json = { eslint, fixjson }, + jsonc = { eslint, fixjson }, + sh = { shellcheck, shfmt }, + javascript = { eslint, prettier_d }, + javascriptreact = { eslint, prettier_d }, + typescriptreact = { eslint, prettier_d }, + svelte = { eslint, prettier_d }, + vue = { eslint, prettier_d }, + markdown = { prettier_d }, + docker = { hadolint, prettier_d }, + solidity = { solhint }, + html = { prettier_d }, + css = { prettier_d }, + c = { clangformat, cpplint }, + cpp = { clangformat, cpplint }, + }, + }, + }) +end + +return { + "neovim/nvim-lspconfig", + config = config, + lazy = false, + dependencies = { + "windwp/nvim-autopairs", + "williamboman/mason.nvim", + "creativenull/efmls-configs-nvim", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-nvim-lsp", + }, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..6960081 --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,14 @@ +return { + "nvim-tree/nvim-tree.lua", + lazy = false, + config = function() + require("nvim-tree").setup({ + filters = { + dotfiles = false, + }, + view = { + adaptive_size = true, + }, + }) + end, +} diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..18d1e9d --- /dev/null +++ b/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,55 @@ +local config = function() + require("nvim-treesitter.configs").setup({ + build = ":TSUpdate", + indent = { + enable = true, + }, + autotag = { + enable = true, + }, + event = { + "BufReadPre", + "BufNewFile", + }, + ensure_installed = { + "rust", + "markdown", + "json", + "javascript", + "typescript", + "yaml", + "html", + "css", + "markdown", + "bash", + "lua", + "dockerfile", + "solidity", + "gitignore", + "python", + "vue", + "svelte", + "toml", + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) +end + +return { + "nvim-treesitter/nvim-treesitter", + lazy = false, + config = config, +} diff --git a/lua/plugins/nvim-ts-autotag.lua b/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..b0af24d --- /dev/null +++ b/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,4 @@ +return { + "windwp/nvim-ts-autotag", + lazy = false, +} diff --git a/lua/plugins/nvim-web-devicons.lua b/lua/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..e318bd5 --- /dev/null +++ b/lua/plugins/nvim-web-devicons.lua @@ -0,0 +1,3 @@ +return { + "nvim-tree/nvim-web-devicons" +} diff --git a/lua/plugins/rust-tools-nvim.lua b/lua/plugins/rust-tools-nvim.lua new file mode 100644 index 0000000..6f7e76f --- /dev/null +++ b/lua/plugins/rust-tools-nvim.lua @@ -0,0 +1,22 @@ +local on_attach = require("util.lsp").on_attach + +return { + "simrat39/rust-tools.nvim", + ft = "rust", + config = function() + local rt = require("rust-tools") + local cmp_nvim_lsp = require("cmp_nvim_lsp") + local capabilities = cmp_nvim_lsp.default_capabilities() + rt.setup({ + server = { + on_attach = on_attach, + capabilities = capabilities, + }, + }) + end, + dependencies = { + "neovim/nvim-lspconfig", + "nvim-lua/plenary.nvim", + "mfussenegger/nvim-dap", + }, +} diff --git a/lua/plugins/tailwind-colorizer-cmp.lua b/lua/plugins/tailwind-colorizer-cmp.lua new file mode 100644 index 0000000..7b80444 --- /dev/null +++ b/lua/plugins/tailwind-colorizer-cmp.lua @@ -0,0 +1,9 @@ +return { + "roobert/tailwindcss-colorizer-cmp.nvim", + -- optionally, override the default options: + config = function() + require("tailwindcss-colorizer-cmp").setup({ + color_square_width = 2, + }) + end, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..21cd44a --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,45 @@ +local mapvimkey = require("util.keymapper").mapvimkey + +local config = function() + local telescope = require("telescope") + telescope.setup({ + defaults = { + mappings = { + i = { + [""] = "move_selection_next", + [""] = "move_selection_previous", + }, + }, + }, + pickers = { + find_files = { + theme = "dropdown", + previewer = true, + hidden = true, + }, + live_grep = { + theme = "dropdown", + previewer = true, + }, + buffers = { + theme = "dropdown", + previewer = true, + }, + }, + }) +end + +return { + "nvim-telescope/telescope.nvim", + tag = "0.1.3", + lazy = false, + dependencies = { "nvim-lua/plenary.nvim" }, + config = config, + keys = { + mapvimkey("fk", "Telescope keymaps", "Show Keymaps"), + mapvimkey("fh", "Telescope help_tags", "Show Help Tags"), + mapvimkey("ff", "Telescope find_files", "Find Files"), + mapvimkey("fg", "Telescope live_grep", "Live Grep"), + mapvimkey("fb", "Telescope buffers", "Find Buffers"), + }, +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..adf9e42 --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,10 @@ +return { + "catppuccin/nvim", + name = "theme", + lazy = false, + priority = 999, + config = function() + vim.cmd("colorscheme catppuccin") + require("catppuccin").setup({}) + end, +} diff --git a/lua/plugins/tmux-navigator.lua b/lua/plugins/tmux-navigator.lua new file mode 100644 index 0000000..6efe1fe --- /dev/null +++ b/lua/plugins/tmux-navigator.lua @@ -0,0 +1,4 @@ +return { + "christoomey/vim-tmux-navigator", + lazy = false, +} diff --git a/lua/plugins/trouble-nvim.lua b/lua/plugins/trouble-nvim.lua new file mode 100644 index 0000000..a9eb30d --- /dev/null +++ b/lua/plugins/trouble-nvim.lua @@ -0,0 +1,37 @@ +local diagnostic_signs = require("util.icons").diagnostic_signs +local maplazykey = require("util.keymapper").maplazykey + +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + signs = { + -- icons / text used for a diagnostic + error = diagnostic_signs.Error, + warning = diagnostic_signs.Warn, + hint = diagnostic_signs.Hint, + information = diagnostic_signs.Info, + other = diagnostic_signs.Info, + }, + }, + keys = { + maplazykey("xx", function() + require("trouble").toggle() + end, "Toggle Trouble"), + maplazykey("xw", function() + require("trouble").toggle("workspace_diagnostics") + end, "Show Workspace Diagnostics"), + maplazykey("xd", function() + require("trouble").toggle("document_diagnostics") + end, "Show Document Diagnostics"), + maplazykey("xq", function() + require("trouble").toggle("quickfix") + end, "Toggle Quickfix List"), + maplazykey("xl", function() + require("trouble").toggle("loclist") + end, "Toggle Location List"), + maplazykey("gR", function() + require("trouble").toggle("lsp_references") + end, "Toggle LSP References"), + }, +} diff --git a/lua/plugins/true-zen.lua b/lua/plugins/true-zen.lua new file mode 100644 index 0000000..62b1dfa --- /dev/null +++ b/lua/plugins/true-zen.lua @@ -0,0 +1,4 @@ +return { + "pocco81/true-zen.nvim", + lazy = false, +} diff --git a/lua/plugins/vim-fugitive.lua b/lua/plugins/vim-fugitive.lua new file mode 100644 index 0000000..230cdb4 --- /dev/null +++ b/lua/plugins/vim-fugitive.lua @@ -0,0 +1,4 @@ +return { + lazy = false, + "tpope/vim-fugitive", +} diff --git a/lua/plugins/vim-highlightedyank.lua b/lua/plugins/vim-highlightedyank.lua new file mode 100644 index 0000000..b2ad788 --- /dev/null +++ b/lua/plugins/vim-highlightedyank.lua @@ -0,0 +1,4 @@ +return { + "machakann/vim-highlightedyank", + lazy = false +} diff --git a/lua/plugins/vim-illuminate.lua b/lua/plugins/vim-illuminate.lua new file mode 100644 index 0000000..7b34f92 --- /dev/null +++ b/lua/plugins/vim-illuminate.lua @@ -0,0 +1,7 @@ +return { + "RRethy/vim-illuminate", + lazy = false, + config = function() + require('illuminate').configure({}) + end +} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua new file mode 100644 index 0000000..498de27 --- /dev/null +++ b/lua/plugins/whichkey.lua @@ -0,0 +1,5 @@ +return { + "folke/which-key.nvim", + lazy = false, + opts = {}, +} diff --git a/lua/util/icons.lua b/lua/util/icons.lua new file mode 100644 index 0000000..59e1548 --- /dev/null +++ b/lua/util/icons.lua @@ -0,0 +1,18 @@ +local M = {} + +M.debugging_signs = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", +} + +M.diagnostic_signs = { + Error = " ", + Warn = " ", + Hint = "", + Info = "", +} + +return M diff --git a/lua/util/keymapper.lua b/lua/util/keymapper.lua new file mode 100644 index 0000000..1a4277a --- /dev/null +++ b/lua/util/keymapper.lua @@ -0,0 +1,69 @@ +local vim_modes = { + n = "n", + i = "i", + v = "v", +} + +local default_opts = { + noremap = true, + silent = true, +} + +--- @param opts (table|nil) +--- @return table +local get_opts = function(opts) + local all_opts = opts + if all_opts == nil then + all_opts = {} + end + for k, v in pairs(default_opts) do + all_opts[k] = all_opts[k] or v + end + return all_opts +end + +--- @param vimmode (string|nil) +--- @return string +local get_mode = function(vimmode) + local modeString = vim_modes[vimmode] + if modeString == nil then + return "n" + else + return modeString + end +end + +--- @param command (string) +--- @return string +local get_cmd_string = function(command) + return [[]] .. command .. [[]] +end + +--- @param keymaps string +--- @param command string +--- @param vimmode (string|nil) +--- @param options (table|nil) +--- @return nil +local mapvimkey = function(keymaps, command, vimmode, options) + local mode = get_mode(vimmode) + local lhs = keymaps + local rhs = get_cmd_string(command) + local opts = get_opts(options) + vim.keymap.set(mode, lhs, rhs, opts) +end + +--- @param keymaps string +--- @param cmd (function|string) +--- @param desc (string|nil) +--- @return table +local maplazykey = function(keymaps, cmd, desc) + if type(cmd) ~= "function" then + cmd = get_cmd_string(cmd) + end + return { keymaps, cmd, desc = desc } +end + +return { + mapvimkey = mapvimkey, + maplazykey = maplazykey, +} diff --git a/lua/util/lsp.lua b/lua/util/lsp.lua new file mode 100644 index 0000000..e72974c --- /dev/null +++ b/lua/util/lsp.lua @@ -0,0 +1,27 @@ +local mapkey = require("util.keymapper").mapvimkey + +local M = {} + +M.on_attach = function(client, bufnr) + local opts = { noremap = true, silent = true, buffer = bufnr } + + mapkey("fd", "Lspsaga finder", "n", opts) -- go to definition + mapkey("gd", "Lspsaga peek_definition", "n", opts) -- peak definition + mapkey("gD", "Lspsaga goto_definition", "n", opts) -- go to definition + mapkey("ca", "Lspsaga code_action", "n", opts) -- see available code actions + mapkey("rn", "Lspsaga rename", "n", opts) -- smart rename + mapkey("D", "Lspsaga show_line_diagnostics", "n", opts) -- show diagnostics for line + mapkey("d", "Lspsaga show_cursor_diagnostics", "n", opts) -- show diagnostics for cursor + mapkey("pd", "Lspsaga diagnostic_jump_prev", "n", opts) -- jump to prev diagnostic in buffer + mapkey("nd", "Lspsaga diagnostic_jump_next", "n", opts) -- jump to next diagnostic in buffer + mapkey("K", "Lspsaga hover_doc", "n", opts) -- show documentation for what is under cursor + + if client.name == "pyright" then + mapkey("oi", "PyrightOrganizeImports", "n", opts) -- organise imports + mapkey("db", "DapToggleBreakpoint", "n", opts) -- toggle breakpoint + mapkey("dr", "DapContinue", "n", opts) -- continue/invoke debugger + mapkey("dt", "lua require('dap-python').test_method()", "n", opts) -- run tests + end +end + +return M diff --git a/neoconf.json b/neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +}