diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index ceef636..0b0668e 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -1,18 +1,40 @@ -local function disable_default_plugins() - -- FIXME: WSL register bug - vim.g.loaded_clipboard_provider = 1 - vim.g.loaded_matchit = 1 - vim.g.loaded_matchparen = 1 - vim.g.loaded_gzip = 1 - vim.g.loaded_tarPlugin = 1 - vim.g.loaded_zipPlugin = 1 - vim.g.loaded_2html_plugin = 1 -end +-- Required to be loaded first by lazy.nvim +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- NOTE: required for WSL register bug +vim.g.loaded_clipboard_provider = 1 -disable_default_plugins() +-- Install lazy +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) --- TODO: remove when https://github.com/neovim/neovim/pull/15436 is merged -pcall(require, "impatient") +require("lazy").setup("plugins", { + defaults = { lazy = true }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) vim.api.nvim_create_user_command("PurgeUndoFiles", function() require("utils.misc").purge_old_undos() diff --git a/dot_config/nvim/lazy-lock.json b/dot_config/nvim/lazy-lock.json new file mode 100644 index 0000000..af4ae9f --- /dev/null +++ b/dot_config/nvim/lazy-lock.json @@ -0,0 +1,66 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" }, + "LuaSnip": { "branch": "master", "commit": "a835e3d680c5940b61780c6af07885db95382478" }, + "aerial.nvim": { "branch": "master", "commit": "ab85d57942b3d7e1a2530af1a083b77f4ba33cba" }, + "chezmoi.vim": { "branch": "main", "commit": "062717b6d67331856ecf75fd36eb0a7db4fbea0b" }, + "clever-f.vim": { "branch": "master", "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, + "cmp-pandoc-references": { "branch": "master", "commit": "2c808dff631a783ddd2c554c4c6033907589baf6" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "codicons.nvim": { "branch": "master", "commit": "1b06e16e799809d886f9dda8e93f12133e18e392" }, + "committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" }, + "dev-comments.nvim": { "branch": "master", "commit": "47bdba970cc1de5145fd1bb0e19bf859b883e959" }, + "dial.nvim": { "branch": "master", "commit": "5020da900cc5dfd7067f181ee2ebd872ca7c84e8" }, + "emmylua-nvim": { "branch": "master", "commit": "63b28c874f41d944678d03d91e3cc2e442dd5736" }, + "feline.nvim": { "branch": "master", "commit": "d48b6f92c6ccdd6654c956f437be49ea160b5b0c" }, + "fidget.nvim": { "branch": "main", "commit": "688b4fec4517650e29c3e63cfbb6e498b3112ba1" }, + "friendly-snippets": { "branch": "main", "commit": "25ddcd96540a2ce41d714bd7fea2e7f75fea8ead" }, + "git-conflict.nvim": { "branch": "main", "commit": "2957f747e1a34f1854e4e0efbfbfa59a1db04af5" }, + "gitsigns.nvim": { "branch": "main", "commit": "b1f9cf7c5c5639c006c937fc1819e09f358210fc" }, + "hop.nvim": { "branch": "master", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, + "hydra.nvim": { "branch": "master", "commit": "928855b69f55c7abcaa6594d20968c33ab2317e6" }, + "iswap.nvim": { "branch": "master", "commit": "aed5aa196651926871a9d881a80aef868199c2a5" }, + "lazy.nvim": { "branch": "main", "commit": "b306eb3d0f32b792929735c6d528c38d0f1dc0cd" }, + "lsp_lines.nvim": { "branch": "main", "commit": "dcff567b3a2d730f31b6da229ca3bb40640ec5a6" }, + "matchparen.nvim": { "branch": "main", "commit": "dc511ea561bb34c99d0fad9a6fd08bb0e4187a5e" }, + "middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" }, + "mkdnflow.nvim": { "branch": "main", "commit": "555bdbaf1daae077000b54c63dec323056b43155" }, + "neogen": { "branch": "main", "commit": "93d997dbddfe084e77ba4541c54a7b8bfd754fb1" }, + "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, + "nnn.vim": { "branch": "master", "commit": "46bb8355a3bbe7df9f466bb116534dda4f257895" }, + "null-ls.nvim": { "branch": "main", "commit": "456a983ce9843123e51b955f50925077ca7207d5" }, + "numb.nvim": { "branch": "master", "commit": "2c89245d1185e02fec1494c45bc765a38b6b40b3" }, + "nvim-FeMaco.lua": { "branch": "main", "commit": "469465fc1adf8bddc2c9bbe549d38304de95e9f7" }, + "nvim-bqf": { "branch": "main", "commit": "1276701ed0216b94d7919d5c07845dcdf05fbde5" }, + "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, + "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" }, + "nvim-lightbulb": { "branch": "master", "commit": "56b9ce31ec9d09d560fe8787c0920f76bc208297" }, + "nvim-lspconfig": { "branch": "master", "commit": "5a871409199d585b52b69952532e3fb435e64566" }, + "nvim-osc52": { "branch": "main", "commit": "47ce7ee2396fa3ee4fb6b0e0ef14ba06f9c9bd31" }, + "nvim-treehopper": { "branch": "master", "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" }, + "nvim-treesitter": { "branch": "master", "commit": "4536156f32b8ab0aab264e3cd7819fc8e3daede4" }, + "nvim-treesitter-pairs": { "branch": "master", "commit": "7a8ebf5fedd56afde510ec022043f0c99ed5d7dc" }, + "nvim-web-devicons": { "branch": "master", "commit": "585dbc29315ca60be67d18ae6175771c3fb6791e" }, + "playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" }, + "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, + "schemastore.nvim": { "branch": "main", "commit": "ac100fa691b10dd990ca0cdc31ebd054a5959b58" }, + "sqls.nvim": { "branch": "main", "commit": "bb70de250433ca5f6f7b617a9b3f5ab02eccf861" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, + "telescope.nvim": { "branch": "master", "commit": "a3f17d3baf70df58b9d3544ea30abe52a7a832c2" }, + "toggleterm.nvim": { "branch": "main", "commit": "9a595ba699837c4333c4296634feed320f084df2" }, + "treesj": { "branch": "main", "commit": "90248883bdb2d559ff4ba7f0148eb0145d3f0908" }, + "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, + "vim-cool": { "branch": "master", "commit": "80c19445728d70595c2f72d0436527e28292ebd9" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" }, + "vim-startuptime": { "branch": "master", "commit": "6580cf539c33a212f4f5542068a3b4dd2b3ad834" }, + "vim-visual-multi": { "branch": "master", "commit": "724bd53adfbaf32e129b001658b45d4c5c29ca1a" }, + "vimtex": { "branch": "master", "commit": "7c1bc9b8ad6c6bddc0194aeb27b34bd1107880f2" }, + "windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" }, + "winshift.nvim": { "branch": "main", "commit": "37468ed6f385dfb50402368669766504c0e15583" } +} \ No newline at end of file diff --git a/dot_config/nvim/lua/modules/feline/init.lua b/dot_config/nvim/lua/modules/feline/init.lua index 3bea31f..d461bb8 100644 --- a/dot_config/nvim/lua/modules/feline/init.lua +++ b/dot_config/nvim/lua/modules/feline/init.lua @@ -1,2 +1,3 @@ +vim.opt.termguicolors = true require("modules.feline.statusline") require("modules.feline.winbar") diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua new file mode 100644 index 0000000..317c1a3 --- /dev/null +++ b/dot_config/nvim/lua/plugins.lua @@ -0,0 +1,579 @@ +return { + -- Common dependencies + { + "nvim-lua/plenary.nvim", + config = function() + require("plenary.filetype").add_file("extra") + end, + }, + + -- + -- LSP, treesitter and completion + -- + { + "neovim/nvim-lspconfig", + init = function() + require("modules.lsp").setup_servers() + end, + }, + + "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + + { + "j-hui/fidget.nvim", + init = function() + require("fidget").setup({ + window = { + blend = 0, + }, + }) + end, + }, + + { + "jose-elias-alvarez/null-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, + init = function() + require("modules.lsp.null_ls") + end, + }, + + "b0o/schemastore.nvim", + + { + "stevearc/aerial.nvim", + cmd = "AerialToggle", + init = function() + vim.keymap.set("n", "a", "AerialToggle", { silent = true }) + end, + config = function() + require("aerial").setup({ + nerd_font = false, + }) + end, + }, + + { + "hrsh7th/nvim-cmp", + dependencies = { + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-buffer" }, + { "saadparwaiz1/cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp-signature-help" }, + { "jc-doyle/cmp-pandoc-references" }, + }, + init = function() + require("modules.cmp") + end, + }, + + "ii14/emmylua-nvim", + + { + "L3MON4D3/LuaSnip", + config = function() + require("modules.snippets") + end, + }, + + "rafamadriz/friendly-snippets", + + "kosayoda/nvim-lightbulb", + + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + init = function() + require("modules.treesitter") + end, + }, + + { + -- "~/src/dev-comments.nvim", + "ram02z/dev-comments.nvim", + init = function() + require("dev_comments").setup() + end, + }, + + { + "nvim-treesitter/playground", + cmd = { "TSPlaygroundToggle", "TSHighlightCapturesUnderCursor" }, + init = function() + vim.keymap.set("n", "tp", "TSPlaygroundToggle", { silent = true }) + vim.keymap.set("n", "th", "TSHighlightCapturesUnderCursor", { silent = true }) + end, + config = function() + require("utils.keychord").cancel("t") + end, + }, + + { + "monkoose/matchparen.nvim", + init = function() + require("matchparen").setup({}) + end, + }, + + { + "ram02z/nvim-treesitter-pairs", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = "VeryLazy", + }, + + { + "mfussenegger/nvim-treehopper", + init = function() + vim.keymap.set({ "o", "x" }, "m", ":lua require'tsht'.nodes()", { silent = true }) + end, + }, + + -- + -- UI + -- + + -- Icons + "kyazdani42/nvim-web-devicons", + + -- Statusline + { + "feline-nvim/feline.nvim", + init = function() + require("modules.feline") + end, + }, + + -- + -- Misc + -- + + -- OSC52 yank + "ojroques/nvim-osc52", + + -- Wrapper around codicons + "mortepau/codicons.nvim", + + -- Repeat support + "tpope/vim-repeat", + + -- + -- Language support + -- + + "alker0/chezmoi.vim", + + { + "jakewvincent/mkdnflow.nvim", + ft = "markdown", + config = function() + require("mkdnflow").setup({ + to_do = { + symbols = { " ", "x", " " }, + complete = "x", + }, + mappings = { + MkdnEnter = false, + MkdnCreateLinkFromClipboard = false, + MkdnNextLink = { "n", "]l" }, + MkdnPrevLink = { "n", "[l" }, + MkdnTableNextCell = false, + MkdnTablePrevCell = false, + MkdnUpdateNumbering = false, + }, + }) + end, + }, + + { + "AckslD/nvim-FeMaco.lua", + cmd = "FeMaco", + init = function() + vim.keymap.set("n", "m", "FeMaco") + end, + config = function() + require("femaco").setup({ + prepare_buffer = function(opts) + vim.cmd("belowright split") + local win = vim.api.nvim_get_current_win() + local buf = vim.api.nvim_create_buf(false, false) + return vim.api.nvim_win_set_buf(win, buf) + end, + }) + end, + }, + + -- Tex support + { + "lervag/vimtex", + ft = "tex", + init = function() + vim.g.tex_flavor = "latex" + vim.g.vimtex_syntax_enabled = 0 + vim.g.vimtex_view_method = "zathura" + vim.g.tex_conceal = "abdmg" + vim.g.vimtex_matchparen_enabled = 0 + end, + }, + + -- SQL + "nanotee/sqls.nvim", + + -- Comment snippets + { + "danymat/neogen", + cmd = "Neogen", + config = function() + require("neogen").setup({ snippet_engine = "luasnip" }) + end, + }, + + -- Git integration + { + "rhysd/committia.vim", + event = "BufReadPost COMMIT_EDITMSG,MERGE_MSG", + }, + { + "lewis6991/gitsigns.nvim", + init = function() + require("modules.gitsigns") + end, + }, + { + "akinsho/git-conflict.nvim", + event = 'BufReadPost', + init = function() + require("git-conflict").setup({ + disable_diagnostics = true, + highlights = { + -- FIXME: lazy loads before colorscheme highlights + -- incoming = "DiffIncoming", + current = "DiffAdd", + }, + }) + vim.keymap.set("n", "cq", "GitConflictListQf") + end, + }, + + -- Toggle terminal + { + "akinsho/toggleterm.nvim", + init = function() + vim.api.nvim_create_user_command("Ca", "TermExec cmd='chezmoi apply'", {}) + vim.cmd([[cabbrev ca Ca]]) + require("toggleterm").setup({ + shell = "/usr/bin/env fish", + open_mapping = [[]], + }) + end, + }, + + -- File manager + { + "mcchrish/nnn.vim", + init = function() + require("nnn").setup({ + set_default_mappings = false, + -- NOTE: might not work because we are using bash as shell + -- command = 'n', + action = { + [""] = "tab split", + [""] = "split", + [""] = "vsplit", + }, + layout = { + window = { + width = 0.9, + height = 0.6, + highlight = "FloatBorder", + }, + }, + replace_netrw = true, + statusline = false, + }) + vim.keymap.set("", "n", "NnnPicker", { silent = true }) + end, + }, + + -- Fuzzy finder + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + init = function() + require("telescope").load_extension("fzf") + end, + }, + + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope-ui-select.nvim", + }, + init = function() + -- Register pickers + vim.keymap.set("i", "", "Telescope registers theme=get_cursor layout_config={height=18}") + vim.keymap.set({ "x", "n" }, '"', "Telescope registers theme=get_cursor layout_config={height=18}") + end, + config = function() + require("modules.telescope") + end, + }, + + { + "nvim-telescope/telescope-ui-select.nvim", + init = function() + require("telescope").load_extension("ui-select") + end, + }, + + -- Extends f/t motions + { + "rhysd/clever-f.vim", + event = "BufReadPost", + init = function() + vim.g.clever_f_smart_case = 1 + vim.g.clever_f_chars_match_any_signs = "#" + vim.g.clever_f_fix_key_direction = 1 + vim.g.clever_f_mark_direct = 1 + end, + config = function() + vim.keymap.set("", ";", "(clever-f-repeat-forward)", { silent = true }) + vim.keymap.set("", ",", "(clever-f-repeat-back)", { silent = true }) + -- FIXME: Issue #61 + vim.keymap.set("n", "", "(clever-f-reset)nod", { silent = true }) + end, + }, + + -- Jump anywhere on screen + { + "phaazon/hop.nvim", + cmd = { "HopWord", "HopPattern" }, + init = function() + vim.keymap.set("n", ";", "HopWord", { silent = true }) + vim.keymap.set("n", "/", "HopPattern", { silent = true }) + end, + config = function() + require("hop").setup({ keys = "asdghklwertyuipzxcvbnmfj" }) + end, + }, + + { + "Wansmer/treesj", + init = function() + vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = "*", + callback = function() + local opts = { buffer = true } + local langs = require("treesj.langs")["presets"] + if langs[vim.bo.filetype] then + vim.keymap.set("n", "gJ", "TSJSplit", opts) + vim.keymap.set("n", "J", "TSJJoin", opts) + end + end, + }) + require("treesj").setup({ use_default_keymaps = false }) + end, + }, + + -- Swap delimiter seperated items + { + "mizlan/iswap.nvim", + cmd = { "ISwap", "ISwapWith" }, + init = function() + vim.keymap.set("n", "gs", "ISwap", { silent = true }) + vim.keymap.set("n", "gS", "ISwapWith", { silent = true }) + end, + }, + + -- Comments + { + "numToStr/Comment.nvim", + init = function() + local ft = require("Comment.ft") + ft.dosini = "#%s" + require("Comment").setup({ + ignore = "^$", + }) + end, + }, + + -- Manipulate pairs + { + "machakann/vim-sandwich", + event = "BufReadPost", + config = function() + vim.cmd([[runtime macros/sandwich/keymap/surround.vim]]) + end, + }, + + -- Color highlighting + { + "NvChad/nvim-colorizer.lua", + event = "BufReadPre", + config = function() + require("colorizer").setup({ + filetypes = { "*" }, + user_default_options = { + RGB = false, + RRGGBB = true, + RRGGBBAA = true, + css_fn = true, + names = false, + mode = "virtualtext", + virtualtext = "■", + }, + }) + end, + }, + + -- Increment/decrement + { + "monaqa/dial.nvim", + init = function() + local augend = require("dial.augend") + + require("dial.config").augends:register_group({ + default = { + augend.integer.alias.decimal_int, + augend.semver.alias.semver, + augend.constant.new({ + elements = { "true", "false" }, + word = true, + cyclic = true, + }), + augend.constant.new({ + elements = { "True", "False" }, + word = true, + cyclic = true, + }), + augend.constant.new({ + elements = { "&&", "||" }, + word = false, + cyclic = true, + }), + }, + visual = { + augend.integer.new({ + radix = 16, + prefix = "0x", + natural = true, + case = "upper", + }), + }, + }) + vim.keymap.set("n", "", require("dial.map").inc_normal(), { silent = true }) + vim.keymap.set("v", "", require("dial.map").inc_visual(), { silent = true }) + vim.keymap.set("n", "", require("dial.map").dec_normal(), { silent = true }) + vim.keymap.set("v", "", require("dial.map").dec_visual(), { silent = true }) + end, + }, + + -- Emacs hydra for neovim + { + "anuvyklack/hydra.nvim", + commit = "928855b69f55c7abcaa6594d20968c33ab2317e6", + init = function() + require("modules.hydra") + end, + }, + + { + "anuvyklack/windows.nvim", + dependencies = { "anuvyklack/middleclass" }, + init = function() + require("windows").setup() + end, + }, + + -- Window shift + { + "sindrets/winshift.nvim", + cmd = "WinShift", + config = function() + require("winshift").setup() + end, + }, + + -- Multiple cursors + { + "mg979/vim-visual-multi", + keys = { + "", + { "", mode = "n" }, + { "", mode = "x" }, + "ut", "UndotreeToggle", { silent = true }) + end, + config = function() + require("utils.keychord").cancel("u") + end, + }, + + -- Remove annoying search highlighting + { + "romainl/vim-cool", + event = { "InsertEnter", "CmdlineEnter" }, + }, + + -- Quickfix helper + { + "kevinhwang91/nvim-bqf", + event = { "FileType qf", "QuickFixCmdPre" }, + config = function() + require("bqf").setup({ + preview = { + auto_preview = false, + delay_syntax = 0, + }, + }) + end, + }, + + -- Profiling + { + "dstein64/vim-startuptime", + cmd = "StartupTime", + }, +} diff --git a/dot_config/nvim/plugin/30-settings.lua.tmpl b/dot_config/nvim/plugin/30-settings.lua.tmpl index 1ecd357..7960f03 100644 --- a/dot_config/nvim/plugin/30-settings.lua.tmpl +++ b/dot_config/nvim/plugin/30-settings.lua.tmpl @@ -1,6 +1,3 @@ -vim.g.mapleader = " " -vim.g.maplocalleader = " " - vim.opt.undolevels = 10000 -- Overriden by vim-undodir-tree @@ -31,8 +28,6 @@ vim.opt.autochdir = true vim.opt.updatetime = 250 -vim.opt.termguicolors = true - vim.opt.hidden = true vim.opt.hlsearch = true diff --git a/dot_config/nvim/plugin/60-mappings.lua b/dot_config/nvim/plugin/50-mappings.lua similarity index 94% rename from dot_config/nvim/plugin/60-mappings.lua rename to dot_config/nvim/plugin/50-mappings.lua index 83fb77c..60eb547 100644 --- a/dot_config/nvim/plugin/60-mappings.lua +++ b/dot_config/nvim/plugin/50-mappings.lua @@ -1,5 +1,8 @@ local K = vim.keymap +-- Plugin manager +K.set("", "", "Lazy sync", { silent = true, desc = "Run install, clean and update" }) + -- Disable exmode K.set("n", "Q", "") diff --git a/dot_config/nvim/plugin/50-plugins.lua b/dot_config/nvim/plugin/50-plugins.lua deleted file mode 100644 index 09b5897..0000000 --- a/dot_config/nvim/plugin/50-plugins.lua +++ /dev/null @@ -1,644 +0,0 @@ --- Install packer -local execute = vim.api.nvim_command - -local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" - -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) -end -execute("packadd packer.nvim") - -local packer = require("packer") - -vim.keymap.set("", "", function() - packer.sync({ preview_updates = true }) -end, { silent = true, desc = "Sync packer preview" }) - -packer.startup({ - function(use) - use({ - "wbthomason/packer.nvim", - opt = true, - }) - - -- Common dependencies - use({ - "nvim-lua/plenary.nvim", - module_pattern = "plenary.*", - config = function() - require("plenary.filetype").add_file("extra") - end, - }) - - -- - -- LSP, treesitter and completion - -- - use({ - "neovim/nvim-lspconfig", - config = [[require'modules.lsp'.setup_servers()]], - }) - - use({ - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - }) - - use({ - "j-hui/fidget.nvim", - module = "fidget", - config = function() - require("fidget").setup({ - window = { - blend = 0, - }, - }) - end, - }) - - use({ - "jose-elias-alvarez/null-ls.nvim", - requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, - config = [[require'modules.lsp.null_ls']], - }) - - use({ - "b0o/schemastore.nvim", - module = "schemastore", - }) - - use({ - "stevearc/aerial.nvim", - cmd = "AerialToggle", - setup = function() - vim.keymap.set("n", "a", "AerialToggle", { silent = true }) - end, - config = function() - require("aerial").setup({ - nerd_font = false, - }) - end, - }) - - use({ - "hrsh7th/nvim-cmp", - requires = { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-buffer" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp-signature-help" }, - { "jc-doyle/cmp-pandoc-references" }, - }, - config = [[require'modules.cmp']], - }) - - use({ - "ii14/emmylua-nvim", - }) - - use({ - "L3MON4D3/LuaSnip", - -- event = "BufReadPost", - -- module_pattern = "luasnip.*", - config = [[require'modules.snippets']], - }) - - use({ - "rafamadriz/friendly-snippets", - }) - - use({ - "kosayoda/nvim-lightbulb", - module = "nvim-lightbulb", - }) - - use({ - -- '~/Downloads/nvim-treesitter', - "nvim-treesitter/nvim-treesitter", - -- NOTE: maybe don't lazyload? - -- with lazyload, if file is opened directly ts plugins won't work until :e! - -- might have something to do with BufReadPre event and after key idk - config = [[require'modules.treesitter']], - run = ":TSUpdate", - }) - - use({ - -- "~/src/dev-comments.nvim", - "ram02z/dev-comments.nvim", - config = function() - require("dev_comments").setup() - end, - }) - - use({ - "nvim-treesitter/playground", - cmd = { "TSPlaygroundToggle", "TSHighlightCapturesUnderCursor" }, - setup = function() - vim.keymap.set("n", "tp", "TSPlaygroundToggle", { silent = true }) - vim.keymap.set("n", "th", "TSHighlightCapturesUnderCursor", { silent = true }) - end, - config = function() - require("utils.keychord").cancel("t") - end, - }) - - use({ - "monkoose/matchparen.nvim", - config = function() - require("matchparen").setup() - end, - }) - - use({ - "ram02z/nvim-treesitter-pairs", - }) - - use({ - "mfussenegger/nvim-treehopper", - config = function() - vim.keymap.set({ "o", "x" }, "m", ":lua require'tsht'.nodes()", { silent = true }) - end, - }) - - -- - -- UI - -- - - -- Icons - use({ - "kyazdani42/nvim-web-devicons", - module = "nvim-web-devicons", - }) - - -- Statusline - use({ - "feline-nvim/feline.nvim", - config = [[require'modules.feline']], - }) - - -- - -- Misc - -- - - -- See https://github.com/neovim/neovim/pull/15436 - use({ "lewis6991/impatient.nvim" }) - - -- OSC52 yank - use({ - "ojroques/nvim-osc52", - module = "osc52", - }) - - -- Wrapper around codicons - use({ - "mortepau/codicons.nvim", - module = "codicons", - }) - - -- Repeat support - use({ - "tpope/vim-repeat", - }) - - -- - -- Language support - -- - - use({ - "alker0/chezmoi.vim", - }) - - use({ - "jakewvincent/mkdnflow.nvim", - ft = "markdown", - config = function() - require("mkdnflow").setup({ - to_do = { - symbols = { " ", "x", " " }, - complete = "x", - }, - mappings = { - MkdnEnter = false, - MkdnCreateLinkFromClipboard = false, - MkdnNextLink = { "n", "]l" }, - MkdnPrevLink = { "n", "[l" }, - MkdnTableNextCell = false, - MkdnTablePrevCell = false, - MkdnUpdateNumbering = false, - }, - }) - end, - }) - - use({ - "AckslD/nvim-FeMaco.lua", - cmd = "FeMaco", - setup = function() - vim.keymap.set("n", "m", "FeMaco") - end, - config = function() - require("femaco").setup({ - prepare_buffer = function(opts) - vim.cmd("belowright split") - local win = vim.api.nvim_get_current_win() - local buf = vim.api.nvim_create_buf(false, false) - return vim.api.nvim_win_set_buf(win, buf) - end, - }) - end, - }) - - -- Tex support - use({ - "lervag/vimtex", - ft = "tex", - setup = function() - vim.g.tex_flavor = "latex" - vim.g.vimtex_syntax_enabled = 0 - vim.g.vimtex_view_method = "zathura" - vim.g.tex_conceal = "abdmg" - vim.g.vimtex_matchparen_enabled = 0 - end, - }) - - -- SQL - use({ - "nanotee/sqls.nvim", - module = "sqls", - }) - - -- Comment snippets - use({ - "danymat/neogen", - cmd = "Neogen", - config = function() - require("neogen").setup({ snippet_engine = "luasnip" }) - end, - }) - - -- Git integration - use({ - { - "rhysd/committia.vim", - event = "BufReadPost COMMIT_EDITMSG,MERGE_MSG", - }, - { - "lewis6991/gitsigns.nvim", - config = [[require'modules.gitsigns']], - }, - { - "akinsho/git-conflict.nvim", - config = function() - require("git-conflict").setup({ - disable_diagnostics = true, - highlights = { - incoming = "DiffIncoming", - current = "DiffAdd", - }, - }) - vim.keymap.set("n", "cq", "GitConflictListQf") - end, - }, - }) - - -- Toggle terminal - use({ - "akinsho/toggleterm.nvim", - cmd = { "ToggleTerm", "TermExec" }, - keys = [[]], - setup = function() - vim.api.nvim_create_user_command("Ca", "TermExec cmd='chezmoi apply'", {}) - vim.cmd([[cabbrev ca Ca]]) - end, - config = function() - require("toggleterm").setup({ - shell = "/usr/bin/env fish", - open_mapping = [[]], - }) - end, - }) - - -- File manager - use({ - "mcchrish/nnn.vim", - config = function() - require("nnn").setup({ - set_default_mappings = false, - -- NOTE: might not work because we are using bash as shell - -- command = 'n', - action = { - [""] = "tab split", - [""] = "split", - [""] = "vsplit", - }, - layout = { - window = { - width = 0.9, - height = 0.6, - highlight = "FloatBorder", - }, - }, - replace_netrw = true, - statusline = false, - }) - vim.keymap.set("", "n", "NnnPicker", { silent = true }) - end, - }) - - -- Fuzzy finder - use({ - "nvim-telescope/telescope.nvim", - requires = { - { - "nvim-telescope/telescope-fzf-native.nvim", - after = "telescope.nvim", - run = "make", - config = function() - require("telescope").load_extension("fzf") - end, - }, - }, - setup = function() - -- Register pickers - vim.keymap.set("i", "", "Telescope registers theme=get_cursor layout_config={height=18}") - vim.keymap.set( - { "x", "n" }, - '"', - "Telescope registers theme=get_cursor layout_config={height=18}" - ) - end, - config = [[require'modules.telescope']], - }) - - use({ - "nvim-telescope/telescope-ui-select.nvim", - after = "telescope.nvim", - config = function() - require("telescope").load_extension("ui-select") - end, - }) - - -- Extends f/t motions - use({ - "rhysd/clever-f.vim", - event = "BufReadPost", - setup = function() - vim.g.clever_f_smart_case = 1 - vim.g.clever_f_chars_match_any_signs = "#" - vim.g.clever_f_fix_key_direction = 1 - vim.g.clever_f_mark_direct = 1 - end, - config = function() - vim.keymap.set("", ";", "(clever-f-repeat-forward)", { silent = true }) - vim.keymap.set("", ",", "(clever-f-repeat-back)", { silent = true }) - -- FIXME: Issue #61 - vim.keymap.set("n", "", "(clever-f-reset)nod", { silent = true }) - end, - }) - - -- Jump anywhere on screen - use({ - "phaazon/hop.nvim", - cmd = "Hop*", - setup = function() - vim.keymap.set("n", ";", "HopWord", { silent = true }) - vim.keymap.set("n", "/", "HopPattern", { silent = true }) - end, - config = function() - require("hop").setup({ keys = "asdghklwertyuipzxcvbnmfj" }) - end, - }) - - use({ - "Wansmer/treesj", - cmd = "TSJ*", - setup = function() - vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = "*", - callback = function() - local opts = { buffer = true } - local langs = require("treesj.langs")["presets"] - if langs[vim.bo.filetype] then - vim.keymap.set("n", "gJ", "TSJSplit", opts) - vim.keymap.set("n", "J", "TSJJoin", opts) - end - end, - }) - end, - config = function() - require("treesj").setup({ use_default_keymaps = false }) - end, - }) - - -- Swap delimiter seperated items - use({ - "mizlan/iswap.nvim", - cmd = "ISwap*", - setup = function() - vim.keymap.set("n", "gs", "ISwap", { silent = true }) - vim.keymap.set("n", "gS", "ISwapWith", { silent = true }) - end, - }) - - -- Comments - use({ - "numToStr/Comment.nvim", - keys = { "gc", "gb" }, - config = function() - local ft = require("Comment.ft") - ft.dosini = "#%s" - require("Comment").setup({ - ignore = "^$", - }) - end, - }) - - -- Manipulate pairs - use({ - "machakann/vim-sandwich", - event = "BufReadPost", - config = function() - vim.cmd([[runtime macros/sandwich/keymap/surround.vim]]) - end, - }) - - -- Color highlighting - use({ - "NvChad/nvim-colorizer.lua", - event = "BufReadPre", - config = function() - require("colorizer").setup({ - filetypes = { "*" }, - user_default_options = { - RGB = false, - RRGGBB = true, - RRGGBBAA = true, - css_fn = true, - names = false, - mode = "virtualtext", - virtualtext = "■", - }, - }) - end, - }) - - -- Increment/decrement - use({ - "monaqa/dial.nvim", - keys = { "", "" }, - config = function() - local augend = require("dial.augend") - - require("dial.config").augends:register_group({ - default = { - augend.integer.alias.decimal_int, - augend.semver.alias.semver, - augend.constant.new({ - elements = { "true", "false" }, - word = true, - cyclic = true, - }), - augend.constant.new({ - elements = { "True", "False" }, - word = true, - cyclic = true, - }), - augend.constant.new({ - elements = { "&&", "||" }, - word = false, - cyclic = true, - }), - }, - visual = { - augend.integer.new({ - radix = 16, - prefix = "0x", - natural = true, - case = "upper", - }), - }, - }) - vim.keymap.set("n", "", require("dial.map").inc_normal(), { silent = true }) - vim.keymap.set("v", "", require("dial.map").inc_visual(), { silent = true }) - vim.keymap.set("n", "", require("dial.map").dec_normal(), { silent = true }) - vim.keymap.set("v", "", require("dial.map").dec_visual(), { silent = true }) - end, - }) - - -- Emacs hydra for neovim - use({ - "anuvyklack/hydra.nvim", - commit = "928855b69f55c7abcaa6594d20968c33ab2317e6", - config = function() - require("modules.hydra") - end, - }) - - use({ - "anuvyklack/windows.nvim", - requires = { "anuvyklack/middleclass" }, - cmd = "Windows*", - config = function() - require("windows").setup() - end, - }) - - -- Window shift - use({ - "sindrets/winshift.nvim", - cmd = "WinShift", - config = function() - require("winshift").setup() - end, - }) - - -- Multiple cursors - use({ - "mg979/vim-visual-multi", - keys = { - "", - "", - "", - "", - "", - "\\\\", - }, - setup = function() - vim.g.VM_set_statusline = 0 - end, - }) - - -- Text manipulation - use({ - "booperlv/nvim-gomove", - config = function() - require("gomove").setup() - end, - }) - - -- Smooth scrolling - use({ - "karb94/neoscroll.nvim", - event = "BufReadPost", - config = [[require'neoscroll'.setup()]], - }) - - -- Peek at lines - use({ - "nacro90/numb.nvim", - event = "CmdlineEnter", - config = [[require'numb'.setup({show_cursorline = true})]], - }) - - -- Undo tree - use({ - "mbbill/undotree", - cmd = "UndotreeToggle", - setup = function() - vim.g.undotree_SplitWidth = 40 - vim.g.undotree_SetFocusWhenToggle = 1 - vim.g.undotree_DiffAutoOpen = 0 - vim.keymap.set("n", "ut", "UndotreeToggle", { silent = true }) - end, - config = function() - require("utils.keychord").cancel("u") - end, - }) - - -- Remove annoying search highlighting - use({ - "romainl/vim-cool", - event = { "InsertEnter", "CmdlineEnter" }, - }) - - -- Quickfix helper - use({ - "kevinhwang91/nvim-bqf", - event = { "FileType qf", "QuickFixCmdPre" }, - config = function() - require("bqf").setup({ - preview = { - auto_preview = false, - delay_syntax = 0, - }, - }) - end, - }) - - -- Profiling - use({ - "dstein64/vim-startuptime", - cmd = "StartupTime", - }) - end, - config = { - profile = { - enable = true, - }, - display = { - prompt_border = "single", - open_fn = function() - return require("packer.util").float({ border = "single" }) - end, - }, - }, -}) diff --git a/dot_config/nvim/plugin/70-diagnostic.lua b/dot_config/nvim/plugin/60-diagnostic.lua similarity index 100% rename from dot_config/nvim/plugin/70-diagnostic.lua rename to dot_config/nvim/plugin/60-diagnostic.lua diff --git a/dot_config/nvim/plugin/80-filetypes.lua b/dot_config/nvim/plugin/70-filetypes.lua similarity index 100% rename from dot_config/nvim/plugin/80-filetypes.lua rename to dot_config/nvim/plugin/70-filetypes.lua