diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..10270b3 --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,2 @@ +--- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/dot_config/nvim/init.lua.tmpl b/dot_config/nvim/init.lua.tmpl deleted file mode 100644 index 3de27c3..0000000 --- a/dot_config/nvim/init.lua.tmpl +++ /dev/null @@ -1,257 +0,0 @@ -{{- if eq .chezmoi.os "openbsd" }} -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) -HOME = os.getenv("HOME") - -vim.g.mapleader = ' ' -vim.g.maplocalleader = '\\' - --- Plugins -require("lazy").setup("plugins") - --- Options -local o = vim.opt - --- basic settings -o.encoding = "utf-8" -o.backspace = "indent,eol,start" -- backspace works on every char in insert mode -o.completeopt = { 'menu', 'menuone', 'noselect' } -o.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions -o.history = 1000 -o.startofline = true -o.title = true -o.clipboard = 'unnamedplus' -o.mouse = "a" -- Enable mouse mode - --- Mapping waiting time -o.timeoutlen = 300 -o.ttimeoutlen = 0 - --- Spellchecker -o.spell = false -o.spelllang = { 'en_us' } -o.spellfile = HOME .. '/.vim/spell/en.utf8.add' -o.thesaurus = HOME .. '/.vim/thesaurus/english.txt' - --- Display -o.showmatch = true -- show matching brackets -o.colorcolumn = '90' -o.confirm = true -- Confirm to save changes before exiting modified buffer -o.cursorline = true -o.scrolloff = 4 -- always show 3 rows from edge of the screen -o.splitbelow = true -o.splitkeep = "screen" -o.splitright = true -o.virtualedit = 'block' -o.synmaxcol = 300 -- stop syntax highlight after x lines for performance -o.laststatus = 3 -- always show status line -o.list = false -- do not display white characters -o.termguicolors = true -o.wrap = false --do not wrap lines even if very long -o.eol = false -- show if there's no eol char -o.showbreak = '↪' -- character to show when line is broken -o.pumblend = 10 -- Popup blend -o.pumheight = 10 -- Maximum number of entries in a popup - --- Folding --- o.foldenable = true --- o.foldnestmax = 2 --- o.foldminlines = 10 --- o.foldmethod = "expr" --- o.foldexpr = "nvim_treesitter#foldexpr()" - --- workaround for Telescope bug -vim.api.nvim_create_autocmd({ "BufEnter" }, { - pattern = { "*" }, - command = "normal zx", -}) - --- Sidebar -o.number = true -- line number on the left -o.relativenumber = true -o.numberwidth = 3 -- always reserve 3 spaces for line number -o.signcolumn = 'yes' -o.modelines = 0 - --- Bottombar -o.showcmd = true -- display command in bottom bar -o.ruler = false -o.showmode = false - --- Search -o.grepformat = "%f:%l:%c:%m" -o.grepprg = "rg --vimgrep" -o.incsearch = true -- starts searching as soon as typing, without enter needed -o.hlsearch = true -- highlighting of search matches -o.ignorecase = true -- ignore letter case when searching -o.smartcase = true -- case insentive unless capitals used in search -o.wildignorecase = true - -o.inccommand = "nosplit" -- preview incremental substitute -o.matchtime = 2 -- delay before showing matching paren -o.mps = vim.o.mps .. ",<:>" - --- White characters -o.smartindent = true -o.breakindent = true -o.tabstop = 2 -o.shiftwidth = 2 -- indentation rule -o.softtabstop = 2 -o.expandtab = true -- expand tab to spaces -o.smarttab = true -o.shiftround = true -- Round indent - --- Shortmess -o.shortmess = o.shortmess - + { - -- A = true, -- don't give the "ATTENTION" message when an existing swap file is found. - I = true, -- don't give the intro message when starting Vim |:intro|. - W = true, -- don't give "written" or "[w]" when writing a file - c = true, -- don't give |ins-completion-menu| messages - C = true, -- don't give |ins-completion-menu| messages - -- m = true, -- use "[+]" instead of "[Modified]" - } - --- Format options -o.formatoptions = o.formatoptions - + { - c = false, - o = false, -- O and o, don't continue comments - r = true, -- Pressing Enter will continue comments - } - -o.fillchars = { - foldopen = "", - foldclose = "", - -- fold = "⸱", - fold = " ", - foldsep = " ", - diff = "╱", - eob = " ", -} - -o.wildmode = "longest:full,full" -- Command-line completion mode --- Backup files -o.hidden = true -o.autowrite = true -o.autoread = true -o.backup = true -- use backup files -o.writebackup = false -o.swapfile = false -- do not use swap file -o.undofile = true -o.undolevels = 10000 -o.updatetime = 200 -- Save swap file and trigger CursorHold -o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files -o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups - --- Commands mode -o.wildmenu = true -- on TAB, complete options for system command -o.wildignore = -'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' - -vim.cmd([[ -au BufRead,BufNewFile *.md set spell tw=80 syntax=markdown -]]) - -vim.g.markdown_recommended_style = 0 -vim.api.nvim_create_user_command('ReloadConfig', 'source $MYVIMRC', {}) - -local group = vim.api.nvim_create_augroup('user_cmds', { clear = true }) - -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight on yank', - group = group, - callback = function() - vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 }) - end, -}) - -local map = vim.keymap.set - -map({ 'n', 'v' }, '', "", { silent = true }) - --- Clear search with -map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) - --- sane regexes -map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true }) - --- don't jump when using * -map('n', '*', '*') - --- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n -map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" }) -map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) -map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" }) -map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) -map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) - --- Same when jumping around -map('n', 'g;', 'g;zz') - --- replace ex mode map and use it for repeating 'q' macro -map('n', 'Q', '@q') -map('v', 'Q', 'norm @q') - --- save file -map({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) -map({ "i", "n" }, "", "silent! xaqa", { desc = "Save all and quit" }) - --- better indenting -map("v", "<", "", ">gv") - --- lazy -map("n", "l", "Lazy", { desc = "Lazy" }) - -map("n", "xl", "lopen", { desc = "Location List" }) -map("n", "xq", "copen", { desc = "Quickfix List" }) - -map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) -map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) - --- Shortcut to close quickfix windows -map('n', 'a', 'windo lcl|ccl') - --- q Closes the current buffer -map('n', 'q', 'bdelete') - --- Easier in-file navigation with Tab and S-Tab -map('n', '', '') -map('n', '', '') -map("n", "-", "Oil", { desc = "Open parent directory" }) - --- Easy buffer navigation -map('n', '', 'h') -map('n', '', 'j') -map('n', '', 'k') -map('n', '', 'l') -map("n", "[b", "bprevious", { desc = "Prev buffer" }) -map("n", "]b", "bnext", { desc = "Next buffer" }) -map("n", "bb", "e #", { desc = "Switch to Other Buffer" }) - -map('n', '', 'resize -2') -map('n', '', 'resize +2') -map('n', '', 'vertical resize -2') -map('n', '', 'vertical resize +2') - --- windows -map("n", "ww", "p", { desc = "Other window", remap = true }) -map("n", "wd", "c", { desc = "Delete window", remap = true }) -map("n", "-", "s", { desc = "Split window below", remap = true }) -map("n", "|", "v", { desc = "Split window right", remap = true }) -{{ else }} -require("config.lazy") -{{ end }} diff --git a/dot_config/nvim/lua/plugins/coding.lua b/dot_config/nvim/lua/plugins/coding.lua new file mode 100644 index 0000000..57b09e3 --- /dev/null +++ b/dot_config/nvim/lua/plugins/coding.lua @@ -0,0 +1,19 @@ +return { + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end, + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = { + fast_wrap = {}, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/coding.lua.tmpl b/dot_config/nvim/lua/plugins/coding.lua.tmpl deleted file mode 100644 index 338f2e6..0000000 --- a/dot_config/nvim/lua/plugins/coding.lua.tmpl +++ /dev/null @@ -1,154 +0,0 @@ -return { -{{- if eq .chezmoi.os "openbsd" }} - -- auto completion - { - "hrsh7th/nvim-cmp", - version = false, -- last release is way too old - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - { - "garymjr/nvim-snippets", - opts = { - friendly_snippets = true, - }, - dependencies = { "rafamadriz/friendly-snippets" }, - }, - }, - opts = function() - vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) - local kind_icons = { - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - Variable = " ", - Class = " ", - Interface = " ", - Module = " ", - Property = " ", - Unit = "", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = "󰅲", - } - - local cmp = require("cmp") - local defaults = require("cmp.config.default")() - return { - completion = { - completeopt = "menu,menuone,noinsert", - }, - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = function(fallback) - cmp.abort() - fallback() - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp", keyword_length = 1 }, - { name = "snippets" }, - { name = "path" }, - }, { - { name = "buffer", keyword_length = 3 }, - }), - formatting = { - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatenates the icons with the name of the item kind - -- Source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - snippets = "[Snippets]", - nvim_lua = "[Lua]", - latex_symbols = "[LaTeX]", - })[entry.source.name] - return vim_item - end - }, - experimental = { - ghost_text = { - hl_group = "CmpGhostText", - }, - }, - sorting = defaults.sorting, - } - end, - keys = { - { - "", - function() - return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - { - "", - function() - return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - }, - config = function(_, opts) - for _, source in ipairs(opts.sources) do - source.group_index = source.group_index or 1 - end - require("cmp").setup(opts) - end, - }, - - { - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", - config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) - end - }, -{{ end }} - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = { - fast_wrap = {}, - }, - }, -} diff --git a/dot_config/nvim/lua/plugins/editor.lua b/dot_config/nvim/lua/plugins/editor.lua deleted file mode 100644 index 27a5c20..0000000 --- a/dot_config/nvim/lua/plugins/editor.lua +++ /dev/null @@ -1,263 +0,0 @@ -return { - -- Fuzzy finder. - { - "nvim-telescope/telescope.nvim", - cmd = "Telescope", - version = false, -- telescope did only one release, so use HEAD for now - dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "gmake", - config = function() - require("telescope").load_extension("fzf") - end, - }, - keys = { - { "", "Telescope find_files", desc = "Find Files" }, - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, - { "/", "Telescope live_grep", desc = "Switch Buffer" }, - { "sh", "Telescope help_tags", desc = "Search help tags" }, - { "sk", "Telescope keymaps", desc = "Key Maps" }, - { "z=", "Telescope spell_suggest", desc = "Spell options" }, - { "ss", "Telescope lsp_document_symbols", desc = "Goto Symbol" }, - }, - opts = function() - local actions = require("telescope.actions") - - local open_with_trouble = function(...) - return require("trouble.providers.telescope").open_with_trouble(...) - end - local open_selected_with_trouble = function(...) - return require("trouble.providers.telescope").open_selected_with_trouble(...) - end - - return { - defaults = { - prompt_prefix = " ", - selection_caret = " ", - layout_config = { horizontal = { preview_width = 0.5 } }, - file_ignore_patterns = { 'node_modules/.*' }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - } - }, - mappings = { - i = { - [""] = open_with_trouble, - [""] = open_selected_with_trouble, - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - [""] = actions.preview_scrolling_down, - [""] = actions.preview_scrolling_up, - }, - n = { - ["q"] = actions.close, - }, - }, - }, - } - end, - }, - { - "nvim-telescope/telescope-bibtex.nvim", - config = function() - require "telescope".load_extension("bibtex") - end, - }, - { - 'numToStr/Comment.nvim', - opts = { - -- add any options here - }, - lazy = false, - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = { - fast_wrap = {}, - }, - }, - - -- which-key helps you remember key bindings by showing a popup - -- with the active keybindings of the command you started typing. - { - "folke/which-key.nvim", - event = "VeryLazy", - opts_extend = { "spec" }, - opts = { - defaults = {}, - spec = { - { - mode = { "n", "v" }, - { "", group = "tabs" }, - { "b", group = "buffer" }, - { "c", group = "code" }, - { "f", group = "file/find" }, - { "g", group = "git" }, - { "gh", group = "hunks" }, - { "q", group = "quit/session" }, - { "s", group = "search" }, - { "sn", group = "noice" }, - { "u", group = "ui" }, - { "w", group = "windows" }, - { "x", group = "diagnostics/quickfix" }, - { "[", group = "prev" }, - { "]", group = "next" }, - { "g", group = "goto" }, - { "gs", group = "surround" }, - }, - }, - }, - }, - - -- git signs highlights text that has changed since the list - -- git commit, and also lets you interactively stage & unstage - -- hunks in a commit. - { - "lewis6991/gitsigns.nvim", - opts = { - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - on_attach = function(buffer) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) - end - - -- stylua: ignore start - map("n", "]h", gs.next_hunk, "Next Hunk") - map("n", "[h", gs.prev_hunk, "Prev Hunk") - map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") - map("n", "ghS", gs.stage_buffer, "Stage Buffer") - map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") - map("n", "ghR", gs.reset_buffer, "Reset Buffer") - map("n", "ghp", gs.preview_hunk, "Preview Hunk") - map("n", "ghb", function() gs.blame_line({ full = true }) end, "Blame Line") - map("n", "ghd", gs.diffthis, "Diff This") - map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") - map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") - end, - }, - }, - - -- Automatically highlights other instances of the word under your cursor. - -- This works with LSP, Treesitter, and regexp matching to find the other - -- instances. - { - "RRethy/vim-illuminate", - opts = { - delay = 200, - large_file_cutoff = 2000, - large_file_overrides = { - providers = { "lsp" }, - }, - }, - config = function(_, opts) - require("illuminate").configure(opts) - - local function map(key, dir, buffer) - vim.keymap.set("n", key, function() - require("illuminate")["goto_" .. dir .. "_reference"](false) - end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) - end - - map("]]", "next") - map("[[", "prev") - - -- also set it after loading ftplugins, since a lot overwrite [[ and ]] - vim.api.nvim_create_autocmd("FileType", { - callback = function() - local buffer = vim.api.nvim_get_current_buf() - map("]]", "next", buffer) - map("[[", "prev", buffer) - end, - }) - end, - keys = { - { "]]", desc = "Next Reference" }, - { "[[", desc = "Prev Reference" }, - }, - }, - - -- better diagnostics list and others - { - "folke/trouble.nvim", - cmd = { "TroubleToggle", "Trouble" }, - opts = { use_diagnostic_signs = true }, - keys = { - { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, - { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, - { "xL", "TroubleToggle loclist", desc = "Location List (Trouble)" }, - { "xQ", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, - { - "[q", - function() - if require("trouble").is_open() then - require("trouble").previous({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cprev) - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - desc = "Previous trouble/quickfix item", - }, - { - "]q", - function() - if require("trouble").is_open() then - require("trouble").next({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cnext) - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - desc = "Next trouble/quickfix item", - }, - }, - }, - - -- Finds and lists all of the TODO, HACK, BUG, etc comment - -- in your project and loads them into a browsable list. - { - "folke/todo-comments.nvim", - cmd = { "TodoTrouble", "TodoTelescope" }, - config = true, - -- stylua: ignore - keys = { - { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, - { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, - { "xt", "TodoTrouble", desc = "Todo (Trouble)" }, - { "xT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme (Trouble)" }, - { "st", "TodoTelescope", desc = "Todo" }, - { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, - }, - }, - { - "folke/flash.nvim", - event = "VeryLazy", - opts = {}, - keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, - { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, - { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, - { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, - }, - } -} diff --git a/dot_config/nvim/lua/plugins/format.lua b/dot_config/nvim/lua/plugins/format.lua deleted file mode 100644 index 5a5552c..0000000 --- a/dot_config/nvim/lua/plugins/format.lua +++ /dev/null @@ -1,45 +0,0 @@ -return { - "stevearc/conform.nvim", - event = { "BufWritePre" }, - cmd = { "ConformInfo" }, - keys = { - { - -- Customize or remove this keymap to your liking - "f", - function() - require("conform").format({ async = true, lsp_fallback = true }) - end, - mode = "", - desc = "Format buffer", - }, - }, - -- Everything in opts will be passed to setup() - opts = { - -- Define your formatters - formatters_by_ft = { - lua = { "stylua" }, - fish = { "fish_indent" }, - perl = { "perltidy" }, - python = { "isort", "black" }, - javascript = { { "prettierd", "prettier" } }, - sh = { "shfmt" }, - }, - -- Set up format-on-save - format_on_save = { - timeout_ms = 3000, - async = false, - quit = false, - lsp_fallback = true - }, - -- Customize formatters - formatters = { - shfmt = { - prepend_args = { "-i", "2" }, - }, - }, - }, - init = function() - -- If you want the formatexpr, here is the place to set it - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - end, -} diff --git a/dot_config/nvim/lua/plugins/git.lua b/dot_config/nvim/lua/plugins/git.lua deleted file mode 100644 index 156990b..0000000 --- a/dot_config/nvim/lua/plugins/git.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "kdheepak/lazygit.nvim", - cmd = { - "LazyGit", - "LazyGitConfig", - "LazyGitCurrentFile", - "LazyGitFilter", - "LazyGitFilterCurrentFile", - }, - -- optional for floating window border decoration - dependencies = { - "nvim-lua/plenary.nvim", - }, - -- setting the keybinding for LazyGit with 'keys' is recommended in - -- order to load the plugin when the command is run for the first time - keys = { - { "gg", "LazyGit", desc = "LazyGit" } - } -} diff --git a/dot_config/nvim/lua/plugins/init.lua b/dot_config/nvim/lua/plugins/init.lua deleted file mode 100644 index 328a17d..0000000 --- a/dot_config/nvim/lua/plugins/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - -- library used by other plugins - { "nvim-lua/plenary.nvim", lazy = true }, -} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua index 9ecc620..6491370 100644 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -3,201 +3,86 @@ return { { "neovim/nvim-lspconfig", opts = { - -- options for vim.diagnostic.config() - diagnostics = { - underline = true, - update_in_insert = false, - virtual_text = { - spacing = 4, - source = "if_many", - prefix = "●", - -- this will set set the prefix to a function that returns the diagnostics icon based on the severity - -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported - -- prefix = "icons", - }, - severity_sort = true, - float = { - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, - }, - -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 - -- Be aware that you also will need to properly configure your LSP server to - -- provide the inlay hints. - inlay_hints = { - enabled = false, - }, - document_highlight = { - enabled = true, - }, - }, - config = function(_, opts) - local lsp = require('lspconfig') - local lsp_defaults = lsp.util.default_config + config = function(_, opts) + local lsp = require("lspconfig") - lsp_defaults.capabilities = vim.tbl_deep_extend( - 'force', - lsp_defaults.capabilities, - require('cmp_nvim_lsp').default_capabilities() - ) - - local sign = function(o) - -- See :help sign_define() - vim.fn.sign_define(o.name, { - texthl = o.name, - text = o.text, - numhl = '' - }) - end - - sign({ name = 'DiagnosticSignError', text = '✘' }) - sign({ name = 'DiagnosticSignWarn', text = '▲' }) - sign({ name = 'DiagnosticSignHint', text = '⚑' }) - sign({ name = 'DiagnosticSignInfo', text = '' }) - - vim.diagnostic.config({ - virtual_text = false, - severity_sort = true, - float = { - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, - }) - - vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( - vim.lsp.handlers.hover, - { border = 'rounded' } - ) - - vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( - vim.lsp.handlers.signature_help, - { border = 'rounded' } - ) - - vim.lsp.handlers["workspace/diagnostic/refresh"] = function(_, _, ctx) - local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id) - pcall(vim.diagnostic.reset, ns) - return true - end - - vim.api.nvim_create_autocmd('BufWritePre', { - pattern = '*.go', - callback = function() - vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true }) - end - }) - - local on_attach = function(client) - local bufmap = function(mode, lhs, rhs) - local opts = { buffer = true } - vim.keymap.set(mode, lhs, rhs, opts) - end - - bufmap('n', 'K', 'lua vim.lsp.buf.hover()') - bufmap('n', 'gd', 'lua vim.lsp.buf.definition()') - bufmap('n', 'gD', 'lua vim.lsp.buf.declaration()') - bufmap('n', 'go', 'lua vim.lsp.buf.type_definition()') - bufmap('n', 'gs', 'lua vim.lsp.buf.signature_help()') - bufmap('n', 'gA', 'Telescope diagnostics') - bufmap('n', 'gr', 'Telescope lsp_references') - bufmap('n', 'gi', 'Telescope lsp_implementations') - bufmap('n', 'cr', 'lua vim.lsp.buf.rename()') - bufmap('n', 'ca', 'lua vim.lsp.buf.code_action()') - bufmap('n', 'gl', 'lua vim.diagnostic.open_float()') - bufmap('n', '[d', 'lua vim.diagnostic.goto_prev()') - bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') - end - - lsp.gopls.setup { - settings = { - gopls = { - gofumpt = true, - codelenses = { - gc_details = false, - generate = true, - regenerate_cgo = true, - run_govulncheck = true, - test = true, - tidy = true, - upgrade_dependency = true, - vendor = true, - }, - hints = { - assignVariableTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true, - }, - analyses = { - fieldalignment = true, - shadow = true, - unusedvariable = true, - unusedwrite = true, - useany = true, - }, - usePlaceholders = true, - completeUnimported = true, - staticcheck = true, - directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, - semanticTokens = true - }, - }, - on_attach = on_attach - } - lsp.clangd.setup { - settings = { - clangd = { - cmd = { - "clangd", - "--background-index", - "--clang-tidy", - "--header-insertion=iwyu", - "--completion-style=detailed", - "--function-arg-placeholders", - "--fallback-style=llvm", - }, - init_options = { + lsp.gopls.setup({ + settings = { + gopls = { + gofumpt = true, + codelenses = { + gc_details = false, + generate = true, + regenerate_cgo = true, + run_govulncheck = true, + test = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + analyses = { + fieldalignment = true, + shadow = true, + unusedvariable = true, + unusedwrite = true, + useany = true, + }, usePlaceholders = true, completeUnimported = true, - clangdFileStatus = true, + staticcheck = true, + directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, + semanticTokens = true, }, }, - }, - on_attach = on_attach - } - lsp.ltex.setup { - on_attach = on_attach, - filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" }, - } - lsp.svelte.setup { on_attach = on_attach } - lsp.perlls.setup { on_attach = on_attach } - lsp.ts_ls.setup { on_attach = on_attach } - lsp.lua_ls.setup { - settings = { - Lua = { - workspace = { - checkThirdParty = false, + }) + lsp.clangd.setup({ + settings = { + clangd = { + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=llvm", + }, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, }, - codeLens = { - enable = true, + }, + }) + lsp.lua_ls.setup({ + settings = { + Lua = { + workspace = { + checkThirdParty = false, + }, + codeLens = { + enable = true, + }, + completion = { + callSnippet = "Replace", + }, + diagnostics = { + globals = { "vim" }, + }, }, - completion = { - callSnippet = "Replace", - }, - diagnostics = { - globals = { 'vim' } - }, - } - }, - on_attach = on_attach - } - end - } + }, + }) + end, + }, + }, } diff --git a/dot_config/nvim/lua/plugins/notes.lua.tmpl b/dot_config/nvim/lua/plugins/notes.lua.tmpl index df1715b..811d07d 100644 --- a/dot_config/nvim/lua/plugins/notes.lua.tmpl +++ b/dot_config/nvim/lua/plugins/notes.lua.tmpl @@ -1,22 +1,4 @@ return { -{{- if eq .chezmoi.os "openbsd" }} - { - "MeanderingProgrammer/render-markdown.nvim", - opts = { - file_types = { "markdown" }, - code = { - sign = false, - width = "block", - right_pad = 1, - }, - heading = { - sign = false, - icons = {}, - }, - }, - ft = { "markdown" }, - }, -{{- end }} { "renerocksai/telekasten.nvim", lazy = true, diff --git a/dot_config/nvim/lua/plugins/treesitter.lua b/dot_config/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index 7845ac3..0000000 --- a/dot_config/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - -- Treesitter is a new parser generator tool that we can - -- use in Neovim to power faster and more accurate - -- syntax highlighting. - { - "nvim-treesitter/nvim-treesitter", - version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "VeryLazy" }, - init = function(plugin) - -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early - -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which - -- no longer trigger the **nvim-treesitter** module to be loaded in time. - -- Luckily, the only things that those plugins need are the custom queries, which we make available - -- during startup. - require("lazy.core.loader").add_to_rtp(plugin) - require("nvim-treesitter.query_predicates") - end, - dependencies = { - { - "nvim-treesitter/nvim-treesitter-textobjects", - config = function() - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - local configs = require("nvim-treesitter.configs") - for name, fn in pairs(move) do - if name:find("goto") == 1 then - move[name] = function(q, ...) - if vim.wo.diff then - local config = configs.get_module("textobjects.move") - [name] ---@type table - for key, query in pairs(config or {}) do - if q == query and key:find("[%]%[][cC]") then - vim.cmd("normal! " .. key) - return - end - end - end - return fn(q, ...) - end - end - end - end, - }, - }, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, - keys = { - { "", desc = "Increment selection" }, - { "", desc = "Decrement selection", mode = "x" }, - }, - opts = { - highlight = { enable = true }, - indent = { enable = true }, - ensure_installed = { - "bash", - "c", - "diff", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "svelte", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "yaml", - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, - }, - }, - }, - config = function(_, opts) - if type(opts.ensure_installed) == "table" then - local added = {} - opts.ensure_installed = vim.tbl_filter(function(lang) - if added[lang] then - return false - end - added[lang] = true - return true - end, opts.ensure_installed) - end - require("nvim-treesitter.configs").setup(opts) - end, - }, -} diff --git a/dot_config/nvim/lua/plugins/ui.lua b/dot_config/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..31b3c8e --- /dev/null +++ b/dot_config/nvim/lua/plugins/ui.lua @@ -0,0 +1,153 @@ +return { + --- statusline + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + opts.sections.lualine_b = { { "branch", icon = " " } } + end, + }, + + { + "RRethy/vim-illuminate", + config = function() + -- change the highlight style + vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" }) + vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" }) + vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" }) + end, + }, + + { + "NvChad/nvim-colorizer.lua", + opts = function(_, opts) + opts.filetypes = { + "html", + "css", + "scss", + "javascript", + "typescript", + "typescriptreact", + "javascriptreact", + "lua", + } + opts.user_default_options = { + mode = "background", + tailwind = false, -- Enable tailwind colors + } + end, + }, + { + "nvimdev/dashboard-nvim", + event = "VimEnter", + opts = function() + vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#79b8ff" }) + vim.api.nvim_set_hl(0, "DashboardIcon", { fg = "#39c5cf" }) + vim.api.nvim_set_hl(0, "DashboardKey", { fg = "#39c5cf" }) + vim.api.nvim_set_hl(0, "DashboardFooter", { fg = "#959da5" }) + local logo = [[ + _ _ _ _ + | | (_) | | | | + _ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| | +| '_ ` _ \ / _ \ / _ \ '_ \| | | | / __| '_ \ / _` | '_ \ / _` | +| | | | | | (_) | __/ |_) | | |_| \__ \ |_) | (_| | | | | (_| | +|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_| ]] + + logo = string.rep("\n", 8) .. logo .. "\n\n" + + local opts = { + theme = "doom", + hide = { + statusline = false, + }, + config = { + header = vim.split(logo, "\n"), + center = { + { + action = "lua LazyVim.pick()()", + desc = " Find file", + icon = " ", + key = "f", + }, + { + action = "Telescope oldfiles", + desc = " Recent files", + icon = " ", + key = "r", + }, + { + action = 'lua LazyVim.pick("live_grep")()', + desc = " Find text", + icon = " ", + key = "g", + }, + { + action = "lua LazyVim.pick.config_files()()", + desc = " Config", + icon = " ", + key = "c", + }, + { + action = "Telekasten find_notes", + desc = " Find notes", + icon = " ", + key = "n", + }, + { + action = "Lazy", + desc = " Lazy", + icon = "󰒲 ", + key = "l", + }, + { action = "qa", desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) + end + + return opts + end, + }, + + { + "stevearc/oil.nvim", + opts = {}, + config = function() + require("oil").setup({ + default_file_explorer = true, + delete_to_trash = true, + skip_confirm_for_simple_edits = true, + view_options = { + show_hidden = true, + natural_order = true, + is_always_hidden = function(name, _) + return name == ".." or name == ".git" + end, + }, + win_options = { + wrap = true, + }, + }) + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/ui.lua.tmpl b/dot_config/nvim/lua/plugins/ui.lua.tmpl deleted file mode 100644 index 940aa0a..0000000 --- a/dot_config/nvim/lua/plugins/ui.lua.tmpl +++ /dev/null @@ -1,593 +0,0 @@ -return { -{{- if eq .chezmoi.os "openbsd" }} - -- Better `vim.notify()` - { - "rcarriga/nvim-notify", - keys = { - { - "un", - function() - require("notify").dismiss({ silent = true, pending = true }) - end, - desc = "Dismiss all Notifications", - }, - }, - opts = { - timeout = 3000, - max_height = function() - return math.floor(vim.o.lines * 0.75) - end, - max_width = function() - return math.floor(vim.o.columns * 0.75) - end, - }, - }, - - -- better vim.ui - { - "stevearc/dressing.nvim", - lazy = true, - init = function() - ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.select = function(...) - require("lazy").load({ plugins = { "dressing.nvim" } }) - return vim.ui.select(...) - end - ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.input = function(...) - require("lazy").load({ plugins = { "dressing.nvim" } }) - return vim.ui.input(...) - end - end, - }, - - -- statusline - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - init = function() - vim.g.lualine_laststatus = vim.o.laststatus - vim.o.laststatus = 0 - end, - opts = { - options = { - theme = 'auto', - icons_enabled = true, - globalstatus = true, - component_separators = "|", - disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { { "branch", icon = " " }, "diagnostics" }, - lualine_c = { "filename" }, - lualine_x = { "encoding", - { - "fileformat", - symbols = { - unix = " ", - dos = " ", - mac = " " - } - }, - { "filetype", icon_only = true } }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - }, - }, - - -- Active indent guide and indent text objects. When you're browsing - -- code, this highlights the current level of indentation, and animates - -- the highlighting. - { - "echasnovski/mini.indentscope", - version = false, -- wait till new 0.7.0 release to put it back on semver - opts = { - -- symbol = "▏", - symbol = "│", - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - - -- Displays a popup with possible key bindings of the command you started typing - { - "folke/which-key.nvim", - opts = function(_, opts) - opts.defaults["sn"] = { name = "+noice" } - end, - }, - - -- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu. - { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - lsp = { - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, - }, - }, - routes = { - { - filter = { - event = "msg_show", - any = { - { find = "%d+L, %d+B" }, - { find = "; after #%d+" }, - { find = "; before #%d+" }, - }, - }, - view = "mini", - }, - }, - presets = { - bottom_search = true, - command_palette = true, - long_message_to_split = true, - inc_rename = true, - }, - }, - -- stylua: ignore - keys = { - { - "", - function() require("noice").redirect(vim.fn.getcmdline()) end, - mode = "c", - desc = - "Redirect Cmdline" - }, - { - "snl", - function() require("noice").cmd("last") end, - desc = - "Noice Last Message" - }, - { - "snh", - function() require("noice").cmd("history") end, - desc = - "Noice History" - }, - { - "sna", - function() require("noice").cmd("all") end, - desc = - "Noice All" - }, - { - "snd", - function() require("noice").cmd("dismiss") end, - desc = - "Dismiss All" - }, - { - "", - function() if not require("noice.lsp").scroll(4) then return "" end end, - silent = true, - expr = true, - desc = - "Scroll forward", - mode = { - "i", "n", "s" } - }, - { - "", - function() if not require("noice.lsp").scroll(-4) then return "" end end, - silent = true, - expr = true, - desc = - "Scroll backward", - mode = { - "i", "n", "s" } - }, - }, - }, - - -- icons - { - "echasnovski/mini.icons", - lazy = true, - opts = { - file = { - [".keep"] = { glyph = "󰊢", hl = "MiniIconsGrey" }, - ["devcontainer.json"] = { glyph = "", hl = "MiniIconsAzure" }, - }, - filetype = { - dotenv = { glyph = "", hl = "MiniIconsYellow" }, - }, - }, - init = function() - package.preload["nvim-web-devicons"] = function() - require("mini.icons").mock_nvim_web_devicons() - return package.loaded["nvim-web-devicons"] - end - end, - }, - { - "nvim-tree/nvim-web-devicons", - lazy = true, - opts = function() - local devicons = require("nvim-web-devicons") - local palette = { - orange = "#d18616", - black = "#586069", - bright_black = "#959da5", - white = "#d1d5da", - bright_white = "#fafbfc", - red = "#ea4a5a", - bright_red = "#f97583", - green = "#34d058", - bright_green = "#85e89d", - yellow = "#ffea7f", - bright_yellow = "#ffea7f", - blue = "#2188ff", - bright_blue = "#79b8ff", - magenta = "#b392f0", - bright_magenta = "#b392f0", - cyan = "#39c5cf", - bright_cyan = "#56d4dd", - } - devicons.set_icon({ - [".zshrc"] = { - icon = " ", - color = palette.bright_black, - name = "Zshrc", - }, - ["bash"] = { - icon = " ", - color = palette.bright_black, - name = "Bash", - }, - ["c"] = { - icon = " ", - color = palette.bright_blue, - name = "C", - }, - ["c++"] = { - icon = " ", - color = palette.bright_red, - name = "CPlusPlus", - }, - ["cc"] = { - icon = " ", - color = palette.bright_red, - name = "CPlusPlus", - }, - ["go"] = { - icon = " ", - color = palette.bright_blue, - name = "Go", - }, - ["js"] = { - icon = " ", - color = palette.yellow, - name = "Js", - }, - ["lua"] = { - icon = " ", - color = palette.bright_blue, - name = "Lua", - }, - ["markdown"] = { - icon = " ", - color = palette.bright_blue, - name = "Markdown", - }, - ["md"] = { - icon = " ", - color = palette.bright_blue, - name = "Md", - }, - ["mdx"] = { - icon = " ", - color = palette.bright_blue, - name = "Mdx", - }, - ["php"] = { - icon = " ", - color = palette.magenta, - name = "Php", - }, - ["pl"] = { - icon = " ", - color = palette.bright_blue, - name = "Pl", - }, - ["py"] = { - icon = " ", - color = palette.bright_blue, - name = "Py", - }, - ["pyc"] = { - icon = " ", - color = palette.bright_blue, - name = "Pyc", - }, - ["pyd"] = { - icon = " ", - color = palette.bright_blue, - name = "Pyd", - }, - ["pyo"] = { - icon = " ", - color = palette.bright_blue, - name = "Pyo", - }, - ["rake"] = { - icon = " ", - color = palette.bright_red, - name = "Rake", - }, - ["rakefile"] = { - icon = " ", - color = palette.bright_red, - name = "Rakefile", - }, - ["rb"] = { - icon = " ", - color = palette.bright_red, - name = "Rb", - }, - ["sh"] = { - icon = " ", - color = palette.bright_black, - name = "Sh", - }, - ["sql"] = { - icon = " ", - color = palette.bright_black, - name = "Sql", - }, - ["svelte"] = { - icon = " ", - color = palette.orange, - name = "Svelte" - }, - ["yaml"] = { - icon = " ", - color = palette.bright_black, - name = "Yaml", - }, - ["yml"] = { - icon = " ", - color = palette.bright_black, - name = "Yml", - }, - ["zsh"] = { - icon = " ", - color = palette.bright_black, - name = "Zsh", - }, - ["terminal"] = { - icon = " ", - color = palette.bright_black, - name = "Terminal", - }, - }) - end, - }, - - { - "yamatsum/nvim-nonicons", - dependencies = { "nvim-tree/nvim-web-devicons" }, - lazy = true - }, - - -- ui components - { "MunifTanjim/nui.nvim", lazy = true }, -{{ else }} - -- change lualine - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function(_, opts) - opts.sections.lualine_b = { { "branch", icon = " " } } - end, - }, -{{ end }} - { - "RRethy/vim-illuminate", - config = function() - -- change the highlight style - vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" }) - vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" }) - vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" }) - end, - }, - - { - "NvChad/nvim-colorizer.lua", - opts = function(_, opts) - opts.filetypes = { - "html", - "css", - "scss", - "javascript", - "typescript", - "typescriptreact", - "javascriptreact", - "lua", - } - opts.user_default_options = { - mode = "background", - tailwind = false, -- Enable tailwind colors - } - end, - }, - - { - "nvimdev/dashboard-nvim", - event = "VimEnter", - opts = function() - vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#79b8ff" }) - vim.api.nvim_set_hl(0, "DashboardIcon", { fg = "#39c5cf" }) - vim.api.nvim_set_hl(0, "DashboardKey", { fg = "#39c5cf" }) - vim.api.nvim_set_hl(0, "DashboardFooter", { fg = "#959da5" }) - local logo = [[ - _ _ _ _ - | | (_) | | | | - _ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| | -| '_ ` _ \ / _ \ / _ \ '_ \| | | | / __| '_ \ / _` | '_ \ / _` | -| | | | | | (_) | __/ |_) | | |_| \__ \ |_) | (_| | | | | (_| | -|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_| ]] - - logo = string.rep("\n", 8) .. logo .. "\n\n" - - local opts = { - theme = "doom", - hide = { - statusline = false, - }, - config = { - header = vim.split(logo, "\n"), - center = { - {{- if eq .chezmoi.os "openbsd" }} - { - action = "Telescope find_files", - desc = " Find file", - icon = " ", - key = "f", - }, - { - action = "Telescope oldfiles", - desc = " Recent files", - icon = " ", - key = "r", - }, - { - action = "Telescope live_grep", - desc = " Find text", - icon = " ", - key = "g", - }, - { - action = [[lua require("telescope.builtin").find_files({ cwd = vim.fn.stdpath("config") })]], - desc = " Config", - icon = " ", - key = "c", - }, - { - action = "Telekasten find_notes", - desc = " Find notes", - icon = " ", - key = "n", - }, - { - action = "Lazy", - desc = " Lazy", - icon = "󰒲 ", - key = "l", - }, - { action = "qa", desc = " Quit", icon = " ", key = "q" }, -{{- else }} - { - action = "lua LazyVim.pick()()", - desc = " Find file", - icon = " ", - key = "f", - }, - { - action = "Telescope oldfiles", - desc = " Recent files", - icon = " ", - key = "r", - }, - { - action = 'lua LazyVim.pick("live_grep")()', - desc = " Find text", - icon = " ", - key = "g", - }, - { - action = "lua LazyVim.pick.config_files()()", - desc = " Config", - icon = " ", - key = "c", - }, - { - action = "Telekasten find_notes", - desc = " Find notes", - icon = " ", - key = "n", - }, - { - action = "Lazy", - desc = " Lazy", - icon = "󰒲 ", - key = "l", - }, - { action = "qa", desc = " Quit", icon = " ", key = "q" }, - {{- end }} - }, - footer = function() - local stats = require("lazy").stats() - local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } - end, - } - } - - for _, button in ipairs(opts.config.center) do - button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - button.key_format = " %s" - end - - -- close Lazy and re-open when the dashboard is ready - if vim.o.filetype == "lazy" then - vim.cmd.close() - vim.api.nvim_create_autocmd("User", { - pattern = "DashboardLoaded", - callback = function() - require("lazy").show() - end, - }) - end - - return opts - end, - }, - - { - "stevearc/oil.nvim", - opts = {}, - config = function() - require("oil").setup({ - default_file_explorer = true, - delete_to_trash = true, - skip_confirm_for_simple_edits = true, - view_options = { - show_hidden = true, - natural_order = true, - is_always_hidden = function(name, _) - return name == '..' or name == '.git' - end, - }, - win_options = { - wrap = true, - } - }) - end, - }, -}