diff options
author | eug-vs <eugene@eug-vs.xyz> | 2024-05-23 15:33:04 +0200 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2024-05-23 15:33:04 +0200 |
commit | bb81e5432f199729627c1e166fd9d4a3801cda89 (patch) | |
tree | 796ac5597eae975a890e4aac0a9bb93426950398 | |
parent | 69ecf60fac9b950e373e6bf69c4e631f5acf7445 (diff) | |
download | dotfiles-bb81e5432f199729627c1e166fd9d4a3801cda89.tar.gz |
chore(nvim): add .stulya.toml
-rw-r--r-- | nvim/.config/nvim/.stylua.toml | 6 | ||||
-rw-r--r-- | nvim/.config/nvim/ftplugin/markdown.lua | 15 | ||||
-rw-r--r-- | nvim/.config/nvim/init.lua | 84 | ||||
-rw-r--r-- | nvim/.config/nvim/lazy-lock.json | 11 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/autoformat.lua | 48 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/completion.lua | 124 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/dadbod.lua | 42 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/hardtime.lua | 6 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/init.lua | 114 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/lsp-config.lua | 176 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/oil.lua | 20 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/telescope.lua | 134 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/treesitter.lua | 50 | ||||
-rw-r--r-- | nvim/.config/nvim/lua/plugins/zettelkasten.lua | 69 |
14 files changed, 472 insertions, 427 deletions
diff --git a/nvim/.config/nvim/.stylua.toml b/nvim/.config/nvim/.stylua.toml new file mode 100644 index 0000000..139e939 --- /dev/null +++ b/nvim/.config/nvim/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "None" diff --git a/nvim/.config/nvim/ftplugin/markdown.lua b/nvim/.config/nvim/ftplugin/markdown.lua index 4d56693..46e26d7 100644 --- a/nvim/.config/nvim/ftplugin/markdown.lua +++ b/nvim/.config/nvim/ftplugin/markdown.lua @@ -1,14 +1,15 @@ -- Add the key mappings only for Markdown files in a zk notebook. -if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then - local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end - local opts = { noremap=true, silent=false } +if require('zk.util').notebook_root(vim.fn.expand '%:p') ~= nil then + local function map(...) + vim.api.nvim_buf_set_keymap(0, ...) + end + local opts = { noremap = true, silent = false } -- Open the link under the caret. - map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts) + map('n', '<CR>', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) -- Open notes linking to the current buffer. - map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts) + map('n', '<leader>zb', '<Cmd>ZkBacklinks<CR>', opts) -- Open notes linked by the current buffer. - map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts) + map('n', '<leader>zl', '<Cmd>ZkLinks<CR>', opts) end - diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index de03b5b..6516127 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,4 +1,4 @@ -vim.opt.mouse = "a" +vim.opt.mouse = 'a' vim.opt.cursorline = true vim.opt.termguicolors = true @@ -8,7 +8,7 @@ vim.opt.relativenumber = true vim.opt.ignorecase = true vim.opt.smartcase = true -vim.opt.clipboard = "unnamedplus" +vim.opt.clipboard = 'unnamedplus' vim.opt.scrolloff = 10 @@ -24,6 +24,8 @@ vim.opt.laststatus = 3 vim.opt.splitright = true vim.opt.splitbelow = true +vim.opt.signcolumn = 'yes' + -- TODO: revisit after experiment vim.opt.undofile = true @@ -32,65 +34,65 @@ vim.opt.breakindent = true -- TODO: revisit after experiment vim.opt.list = true -vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- TODO: revisit after experiment -vim.opt.inccommand = "split" +vim.opt.inccommand = 'split' -- Windows navigation -vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" }) -vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" }) -vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" }) -vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" }) +vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) -vim.keymap.set("n", "<leader>s", "<CMD>source %<CR>", { desc = "Source current file" }) +vim.keymap.set('n', '<leader>s', '<CMD>source %<CR>', { desc = 'Source current file' }) -- Easier indentation -vim.keymap.set("v", "<", "<gv") -vim.keymap.set("v", ">", ">gv") +vim.keymap.set('v', '<', '<gv') +vim.keymap.set('v', '>', '>gv') -- Moving selection around -vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move selection down" }) -vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move selection up" }) +vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move selection down' }) +vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move selection up' }) -- Highlight on yank -vim.api.nvim_create_autocmd("TextYankPost", { - desc = "Highlight when yanking (copying) text", - group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, }) -- Colorscheme vim.g.gruvbox_material_enable_bold = 1 -vim.g.gruvbox_material_menu_selection_background = "green" -vim.g.gruvbox_material_sign_column_background = "none" -vim.g.gruvbox_material_visual = "green background" -vim.g.gruvbox_material_palette = "original" -vim.cmd.colorscheme("gruvbox-material") +vim.g.gruvbox_material_menu_selection_background = 'green' +vim.g.gruvbox_material_sign_column_background = 'none' +vim.g.gruvbox_material_visual = 'green background' +vim.g.gruvbox_material_palette = 'original' +vim.cmd.colorscheme 'gruvbox-material' -- Diagnostic -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) -vim.keymap.set("n", "L", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) -vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) +vim.keymap.set('n', 'L', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) +vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Lazy.nvim -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or 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, - }) + 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("lazy").setup("plugins", { - change_detection = { - notify = false, - }, +require('lazy').setup('plugins', { + change_detection = { + notify = false, + }, }) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index f1c5c22..55e9a81 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -3,14 +3,13 @@ "LuaSnip": { "branch": "master", "commit": "de1a287c9cb525ae52bc846e8f6207e5ef1da5ac" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, "copilot.vim": { "branch": "release", "commit": "25feddf8e3aa79f0573c8f43ddb13c44c530cfa5" }, "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, - "gitsigns.nvim": { "branch": "main", "commit": "a28bb1db506df663b063cc63f44fbbda178255a7" }, + "gitsigns.nvim": { "branch": "main", "commit": "cdfcd9d39d23c46ae9a040de2c6a8b8bf868746e" }, "gruvbox-material": { "branch": "master", "commit": "aa8096277690db1e1807ec57812c2cf3d54bb37f" }, "hardtime.nvim": { "branch": "main", "commit": "eaf4bc31b86419c26ad7b3a142dd36ca545ca2e4" }, "lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" }, @@ -18,19 +17,21 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c1fbdcb0d8d1295314f1612c4a247253e70299d9" }, "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, + "mini.nvim": { "branch": "main", "commit": "f536bae110335009dc6d17e42f7429eb1ad65fc1" }, "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, "nui.nvim": { "branch": "main", "commit": "b1b3dcd6ed8f355c78bad3d395ff645be5f8b6ae" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-lspconfig": { "branch": "master", "commit": "eadcee1573ca9d0e0cd36a49f620186a8dfdc607" }, - "nvim-treesitter": { "branch": "master", "commit": "30de5e7e9486fb1b1b8c2a1e71052b13f94f1cb0" }, + "nvim-lspconfig": { "branch": "master", "commit": "2c1877081b237a643e52ebdebaf36c84a2695639" }, + "nvim-treesitter": { "branch": "master", "commit": "3e454836ce8350d1f7b780a1a34e5cbfc9ecf715" }, "nvim-ts-autotag": { "branch": "main", "commit": "8ae54b90e36ef1fc5267214b30c2cbff71525fe4" }, "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, "oil.nvim": { "branch": "master", "commit": "2cb39e838e9dcd8b374f09a3a87a2e5ec9d372f6" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "4aed63995a69e343b068c7469491a8d1592c339f" }, + "telescope.nvim": { "branch": "master", "commit": "5665d93988acfbb0747bdbf4f4cb583bcebc8930" }, + "todo-comments.nvim": { "branch": "main", "commit": "e1549807066947818113a7d7ed48f637e49620d3" }, "vim-css-color": { "branch": "master", "commit": "950e80352b325ff26d3b0faf95b29e301c200f7d" }, "vim-dadbod": { "branch": "master", "commit": "fb30422b7bee7e2fa4205a4d226f01477f4fc593" }, "vim-dadbod-completion": { "branch": "master", "commit": "5d5ad196fcde223509d7dabbade0148f7884c5e3" }, diff --git a/nvim/.config/nvim/lua/plugins/autoformat.lua b/nvim/.config/nvim/lua/plugins/autoformat.lua index fb0b510..952c3aa 100644 --- a/nvim/.config/nvim/lua/plugins/autoformat.lua +++ b/nvim/.config/nvim/lua/plugins/autoformat.lua @@ -1,26 +1,26 @@ return { - "stevearc/conform.nvim", - lazy = false, - keys = { - { - "<leader>f", - function() - require("conform").format({ async = true, lsp_fallback = true }) - end, - mode = "", - desc = "[F]ormat buffer", - }, - }, - opts = { - notify_on_error = false, - format_on_save = { - timeout_ms = 500, - }, - formatters_by_ft = { - lua = { "stylua" }, - javascript = { { "prettierd", "prettier" } }, -- @fsouza/prettierd - typescript = { { "prettierd", "prettier" } }, - typescriptreact = { { "prettierd", "prettier" } }, - }, - }, + 'stevearc/conform.nvim', + lazy = false, + keys = { + { + '<leader>f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = { + timeout_ms = 500, + }, + formatters_by_ft = { + lua = { 'stylua' }, + javascript = { { 'prettierd', 'prettier' } }, -- @fsouza/prettierd + typescript = { { 'prettierd', 'prettier' } }, + typescriptreact = { { 'prettierd', 'prettier' } }, + }, + }, } diff --git a/nvim/.config/nvim/lua/plugins/completion.lua b/nvim/.config/nvim/lua/plugins/completion.lua index b7376bd..e5a2f6d 100644 --- a/nvim/.config/nvim/lua/plugins/completion.lua +++ b/nvim/.config/nvim/lua/plugins/completion.lua @@ -1,68 +1,68 @@ return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { - "L3MON4D3/LuaSnip", - build = "make install_jsregexp", - dependencies = { - { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - }, - }, - "saadparwaiz1/cmp_luasnip", + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + { + 'L3MON4D3/LuaSnip', + build = 'make install_jsregexp', + dependencies = { + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, + }, + }, + 'saadparwaiz1/cmp_luasnip', - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-buffer", - "onsails/lspkind-nvim", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - luasnip.config.setup({}) + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-buffer', + 'onsails/lspkind-nvim', + }, + config = function() + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = "menu,menuone,noinsert" }, + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, - mapping = cmp.mapping.preset.insert({ - ["<C-n>"] = cmp.mapping.select_next_item(), - ["<C-p>"] = cmp.mapping.select_prev_item(), - ["<C-b>"] = cmp.mapping.scroll_docs(-4), - ["<C-f>"] = cmp.mapping.scroll_docs(4), - ["<CR>"] = cmp.mapping.confirm({ select = true }), + mapping = cmp.mapping.preset.insert { + ['<C-n>'] = cmp.mapping.select_next_item(), + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<CR>'] = cmp.mapping.confirm { select = true }, - ["<C-k>"] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { "i", "s" }), - ["<C-j>"] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - { name = "buffer", keyword_length = 5 }, - }, - formatting = { - format = require("lspkind").cmp_format({ - with_text = true, - }), - }, - }) - end, + ['<C-k>'] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + ['<C-j>'] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + { name = 'buffer', keyword_length = 5 }, + }, + formatting = { + format = require('lspkind').cmp_format { + with_text = true, + }, + }, + } + end, } diff --git a/nvim/.config/nvim/lua/plugins/dadbod.lua b/nvim/.config/nvim/lua/plugins/dadbod.lua index ac3446b..c31f2a0 100644 --- a/nvim/.config/nvim/lua/plugins/dadbod.lua +++ b/nvim/.config/nvim/lua/plugins/dadbod.lua @@ -1,24 +1,24 @@ return { - "kristijanhusak/vim-dadbod-ui", - dependencies = { - { "tpope/vim-dadbod", lazy = true }, - { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, - }, - cmd = { - "DBUI", - "DBUIToggle", - "DBUIAddConnection", - "DBUIFindBuffer", - }, - init = function() - vim.g.db_ui_use_nerd_fonts = 1 - vim.g.db_ui_env_variable_url = "DATABASE_URL" + 'kristijanhusak/vim-dadbod-ui', + dependencies = { + { 'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function() + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_env_variable_url = 'DATABASE_URL' - require("cmp").setup.filetype({ "sql" }, { - sources = { - { name = "vim-dadbod-completion" }, - { name = "buffer" }, - }, - }) - end, + require('cmp').setup.filetype({ 'sql' }, { + sources = { + { name = 'vim-dadbod-completion' }, + { name = 'buffer' }, + }, + }) + end, } diff --git a/nvim/.config/nvim/lua/plugins/hardtime.lua b/nvim/.config/nvim/lua/plugins/hardtime.lua index 681b96a..d13d04b 100644 --- a/nvim/.config/nvim/lua/plugins/hardtime.lua +++ b/nvim/.config/nvim/lua/plugins/hardtime.lua @@ -1,5 +1,5 @@ return { - "m4xshen/hardtime.nvim", - dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - opts = {} + 'm4xshen/hardtime.nvim', + dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' }, + opts = {}, } diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua index df23851..6566943 100644 --- a/nvim/.config/nvim/lua/plugins/init.lua +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -1,39 +1,79 @@ return { - "sainnhe/gruvbox-material", - { "numToStr/Comment.nvim", opts = {} }, - { -- Adds git related signs to the gutter, as well as utilities for managing changes - "lewis6991/gitsigns.nvim", - opts = { - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - }, - }, - { - "windwp/nvim-ts-autotag", - init = function() - require("nvim-ts-autotag").setup({ - opts = { - enable_close = true, -- Auto close tags - enable_rename = true, -- Auto rename pairs of tags - enable_close_on_slash = false, -- Auto close on trailing </ - }, - }) - end, - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - init = function() - require("nvim-autopairs").setup({}) - end, - }, - "christoomey/vim-tmux-navigator", - "ap/vim-css-color", - "tonchis/vim-to-github", - "github/copilot.vim", + 'sainnhe/gruvbox-material', + { 'numToStr/Comment.nvim', opts = {} }, + { -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + { + 'windwp/nvim-ts-autotag', + init = function() + require('nvim-ts-autotag').setup { + opts = { + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false, -- Auto close on trailing </ + }, + } + end, + }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + dependencies = { 'hrsh7th/nvim-cmp' }, + init = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, + }, + -- Highlight TODOs in comments, quickfix list for TODOs etc + { + 'folke/todo-comments.nvim', + event = 'VimEnter', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { signs = false }, + }, + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + commit = 'f536bae110335009dc6d17e42f7429eb1ad65fc1', -- TODO: update when statusline is fixed + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [']quote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + local statusline = require 'mini.statusline' + statusline.setup { use_icons = true } + + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + end, + }, + 'christoomey/vim-tmux-navigator', + 'ap/vim-css-color', + 'tonchis/vim-to-github', + 'github/copilot.vim', } diff --git a/nvim/.config/nvim/lua/plugins/lsp-config.lua b/nvim/.config/nvim/lua/plugins/lsp-config.lua index ff5b510..19c408b 100644 --- a/nvim/.config/nvim/lua/plugins/lsp-config.lua +++ b/nvim/.config/nvim/lua/plugins/lsp-config.lua @@ -1,99 +1,99 @@ return { - "neovim/nvim-lspconfig", - dependencies = { - { "williamboman/mason.nvim", config = true }, - "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", + 'neovim/nvim-lspconfig', + dependencies = { + { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- Useful status updates for LSP. - { "j-hui/fidget.nvim", opts = {} }, + -- Useful status updates for LSP. + { 'j-hui/fidget.nvim', opts = {} }, - -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { "folke/neodev.nvim", opts = {} }, - }, - config = function() - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), - callback = function(event) - local map = function(keys, func, desc) - vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) - end + -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + { 'folke/neodev.nvim', opts = {} }, + }, + config = function() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") - map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame") - map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction") - map("K", vim.lsp.buf.hover, "Hover Documentation") - end, - }) + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') + map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + map('K', vim.lsp.buf.hover, 'Hover Documentation') + end, + }) - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`tsserver`) will work just fine + -- tsserver = {}, + -- - tsserver = {}, - eslint = {}, - tailwindcss = {}, - prismals = {}, - jsonls = {}, - ansiblels = {}, - vuels = {}, - rust_analyzer = {}, - pylsp = {}, - lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } + tsserver = {}, + eslint = {}, + tailwindcss = {}, + prismals = {}, + jsonls = {}, + ansiblels = {}, + vuels = {}, + rust_analyzer = {}, + pylsp = {}, + lua_ls = { + -- cmd = {...}, + -- filetypes = { ...}, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } - require("mason").setup() + require('mason').setup() - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - "stylua", -- Used to format Lua code - }) - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require("mason-lspconfig").setup({ - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) - server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - require("lspconfig")[server_name].setup(server) - end, - }, - }) - end, + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, } diff --git a/nvim/.config/nvim/lua/plugins/oil.lua b/nvim/.config/nvim/lua/plugins/oil.lua index 6db54db..52e76e7 100644 --- a/nvim/.config/nvim/lua/plugins/oil.lua +++ b/nvim/.config/nvim/lua/plugins/oil.lua @@ -1,13 +1,13 @@ return { - "stevearc/oil.nvim", - init = function() - require("oil").setup({ - columns = { "icon" }, - view_options = { - show_hidden = true, - }, - }) + 'stevearc/oil.nvim', + init = function() + require('oil').setup { + columns = { 'icon' }, + view_options = { + show_hidden = true, + }, + } - vim.api.nvim_set_keymap("n", "<F3>", ":Oil<CR>", { desc = "Open parent directory" }) - end, + vim.api.nvim_set_keymap('n', '<F3>', ':Oil<CR>', { desc = 'Open parent directory' }) + end, } diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index d172638..486206f 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -1,76 +1,76 @@ return { -- Fuzzy Finder (files, lsp, etc) - "nvim-telescope/telescope.nvim", - event = "VimEnter", - dependencies = { - "nvim-lua/plenary.nvim", - { -- If encountering errors, see telescope-fzf-native README for installation instructions - "nvim-telescope/telescope-fzf-native.nvim", + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + dependencies = { + 'nvim-lua/plenary.nvim', + { -- If encountering errors, see telescope-fzf-native README for installation instructions + 'nvim-telescope/telescope-fzf-native.nvim', - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = "make", + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. + build = 'make', - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable("make") == 1 - end, - }, - { "nvim-telescope/telescope-ui-select.nvim" }, - { "nvim-tree/nvim-web-devicons" }, - }, - config = function() - require("telescope").setup({ - defaults = { - layout_strategy = "vertical", - }, - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown(), - }, - }, - }) + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-tree/nvim-web-devicons' }, + }, + config = function() + require('telescope').setup { + defaults = { + layout_strategy = 'vertical', + }, + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } - -- Enable Telescope extensions if they are installed - pcall(require("telescope").load_extension, "fzf") - pcall(require("telescope").load_extension, "ui-select") + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') - -- See `:help telescope.builtin` - local builtin = require("telescope.builtin") - vim.keymap.set("n", "<leader>ff", function() - builtin.find_files(require("telescope.themes").get_dropdown({ - previewer = false, - find_command = { "rg", "--files", "--iglob", "!.git", "--hidden" }, - })) - end, { desc = "[F]ind [F]iles" }) - vim.keymap.set("n", "<leader>fs", builtin.builtin, { desc = "[F]ind [S]elect Telescope" }) - vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "[F]ind by [G]rep" }) - vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "[F]ind [D]iagnostics" }) - vim.keymap.set("n", "<leader>fr", builtin.resume, { desc = "[F]ind [R]esume" }) - vim.keymap.set("n", "<leader>f.", builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) - vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" }) + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', '<leader>ff', function() + builtin.find_files(require('telescope.themes').get_dropdown { + previewer = false, + find_command = { 'rg', '--files', '--iglob', '!.git', '--hidden' }, + }) + end, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', '<leader>fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) + vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set("n", "<leader>/", function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 10, - previewer = false, - })) - end, { desc = "[/] Fuzzily search in current buffer" }) + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set('n', '<leader>/', function() + -- You can pass additional configuration to Telescope to change the theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set("n", "<leader>f/", function() - builtin.live_grep({ - grep_open_files = true, - prompt_title = "Live Grep in Open Files", - }) - end, { desc = "[F]ind [/] in Open Files" }) + -- It's also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', '<leader>f/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[F]ind [/] in Open Files' }) - -- Shortcut for searching your Neovim configuration files - vim.keymap.set("n", "<leader>fn", function() - builtin.find_files({ cwd = vim.fn.stdpath("config") }) - end, { desc = "[F]ind [N]eovim files" }) - end, + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', '<leader>fn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[F]ind [N]eovim files' }) + end, } diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 5852a6d..b876325 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -1,29 +1,29 @@ return { -- Highlight, edit, and navigate code - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - opts = { - ensure_installed = { "bash", "c", "diff", "html", "lua", "luadoc", "markdown", "vim", "vimdoc", "typescript" }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { enable = true }, - }, - config = function(_, opts) - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc', 'typescript' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + }, + config = function(_, opts) + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - -- Prefer git instead of curl in order to improve connectivity in some environments - require("nvim-treesitter.install").prefer_git = true - ---@diagnostic disable-next-line: missing-fields - require("nvim-treesitter.configs").setup(opts) + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup(opts) - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - end, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + end, } diff --git a/nvim/.config/nvim/lua/plugins/zettelkasten.lua b/nvim/.config/nvim/lua/plugins/zettelkasten.lua index e802545..626cb7c 100644 --- a/nvim/.config/nvim/lua/plugins/zettelkasten.lua +++ b/nvim/.config/nvim/lua/plugins/zettelkasten.lua @@ -1,43 +1,38 @@ return { - "mickael-menu/zk-nvim", - init = function() - require("zk").setup({ - picker = "telescope", - lsp = { - config = { - cmd = { "zk", "lsp" }, - name = "zk", - -- TODO: do I need this? Seems to work without - -- on_attach = on_attach, - -- flags = flags, - -- capabilities = capabilities, - }, + 'mickael-menu/zk-nvim', + init = function() + require('zk').setup { + picker = 'telescope', + lsp = { + config = { + cmd = { 'zk', 'lsp' }, + name = 'zk', + -- TODO: do I need this? Seems to work without + -- on_attach = on_attach, + -- flags = flags, + -- capabilities = capabilities, + }, - -- automatically attach buffers in a zk notebook that match the given filetypes - auto_attach = { - enabled = true, - filetypes = { "markdown" }, - }, - }, - }) - local opts = { noremap = true, silent = false } + -- automatically attach buffers in a zk notebook that match the given filetypes + auto_attach = { + enabled = true, + filetypes = { 'markdown' }, + }, + }, + } + local opts = { noremap = true, silent = false } - -- Create a new note after asking for its title. - vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts) + -- Create a new note after asking for its title. + vim.api.nvim_set_keymap('n', '<leader>zn', "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts) - -- Open notes. - vim.api.nvim_set_keymap("n", "<leader>zz", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts) - -- Open notes associated with the selected tags. - vim.api.nvim_set_keymap("n", "<leader>zt", "<Cmd>ZkTags<CR>", opts) + -- Open notes. + vim.api.nvim_set_keymap('n', '<leader>zz', "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts) + -- Open notes associated with the selected tags. + vim.api.nvim_set_keymap('n', '<leader>zt', '<Cmd>ZkTags<CR>', opts) - -- Search for the notes matching a given query. - vim.api.nvim_set_keymap( - "n", - "<leader>zf", - "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", - opts - ) - -- Search for the notes matching the current visual selection. - vim.api.nvim_set_keymap("v", "<leader>zf", ":'<,'>ZkMatch<CR>", opts) - end, + -- Search for the notes matching a given query. + vim.api.nvim_set_keymap('n', '<leader>zf', "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", opts) + -- Search for the notes matching the current visual selection. + vim.api.nvim_set_keymap('v', '<leader>zf', ":'<,'>ZkMatch<CR>", opts) + end, } |