-- disable distribution plugins vim.g.loaded_gzip = 1 vim.g.loaded_tar = 1 vim.g.loaded_tarPlugin = 1 vim.g.loaded_zip = 1 vim.g.loaded_zipPlugin = 1 vim.g.loaded_getscript = 1 vim.g.loaded_getscriptPlugin = 1 vim.g.loaded_vimball = 1 vim.g.loaded_vimballPlugin = 1 vim.g.loaded_matchit = 1 -- vim.g.loaded_matchparen = 1 vim.g.loaded_2html_plugin = 1 vim.g.loaded_logiPat = 1 vim.g.loaded_rrhelper = 1 vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwSettings = 1 vim.g.loaded_netrwFileHandlers = 1 local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' if not vim.uv.fs_stat(lazypath) then vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath, }) end vim.opt.rtp:prepend(lazypath) local pluginspec = { { 'lewis6991/gitsigns.nvim', lazy = false, opts = { signs = { change = { hl = 'GitSignsChange', text = '▋', numhl = 'GitSignsChangeLn' }, add = { hl = 'GitSignsAdd', text = '▋', numhl = 'GitSignsAddLn' }, delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteLn' }, topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteLn' }, changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeLn' }, }, signcolumn = true, numhl = false, linehl = false, word_diff = false, preview_config = { border = _G.floating_win_border, }, on_attach = function(bufnr) local gs = require('gitsigns') vim.keymap.set('n', ']c', function() if vim.wo.diff then return ']c' end vim.schedule(gs.next_hunk) return '' end, { buffer = bufnr, expr = true, desc = 'next hunk' }) vim.keymap.set('n', '[c', function() if vim.wo.diff then return '[c' end vim.schedule(gs.prev_hunk) return '' end, { buffer = bufnr, expr = true, desc = 'previous hunk' }) vim.keymap.set('n', 'hb', function() gs.blame_line({ full = true }) end, { buffer = bufnr, desc = 'show line blame (full)' }) vim.keymap.set('n', 'hB', function() gs.blame_line({ full = false }) end, { buffer = bufnr, desc = 'show line blame (compact)' }) vim.keymap.set( 'n', 'hp', gs.preview_hunk, { buffer = bufnr, desc = 'preview hunk' } ) vim.keymap.set('n', 'hd', gs.diffthis, { buffer = bufnr, desc = 'diff this' }) vim.keymap.set('n', 'hl', function() gs.setqflist(0, { open = false }) vim.schedule(function() require('telescope.builtin').quickfix() end) end, { buffer = bufnr, desc = 'list hunks' }) vim.keymap.set('n', 'gs', vim.cmd.Gitsigns, { buffer = bufnr, desc = 'gitsigns', }) end, }, }, { 'lukas-reineke/indent-blankline.nvim', lazy = false, main = 'ibl', opts = { indent = { char = '▏', highlight = { 'NonText' }, }, exclude = { filetypes = { 'alpha' }, }, scope = { enabled = true, show_start = false, show_end = false, highlight = { 'Comment' }, }, }, keys = { { 'ti', vim.cmd.IBLToggle, desc = 'toggle indent-blankline', }, }, }, { 'numToStr/Comment.nvim', opts = { opleader = { block = 'gC' }, }, keys = { 'gcc', { 'gc', mode = 'v' }, { 'gC', mode = 'v' }, }, }, { 'windwp/nvim-autopairs', priority = 40, event = 'InsertEnter', config = true, }, { 'elihunter173/dirbuf.nvim', enabled = true, dev = true, lazy = false, keys = { { '', function() local cpath = require('dirbuf').get_cursor_path() for _, w in ipairs(vim.api.nvim_list_wins()) do if vim.api.nvim_get_option_value('previewwindow', { win = w }) then if vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w)) == cpath then vim.cmd.pclose() return end end end require('dirbuf').enter('pedit') end, desc = 'Dirbuf: preview file', }, }, }, { 'nvim-tree/nvim-tree.lua', version = '*', main = 'nvim-tree', enabled = false, lazy = false, dependencies = { 'nvim-tree/nvim-web-devicons' }, opts = { renderer = { icons = { show = { file = false, folder = false, folder_arrow = true, git = false, }, glyphs = { default = '󰈤 ', symlink = '󰌹 ', bookmark = 'b', folder = { arrow_open = '▾', arrow_closed = '▸', default = '󰉖 ', open = '󰷏 ', empty = '󱞞 ', symlink = '󰌹 ', }, }, }, }, -- on_attach = function(bufnr) -- end, }, keys = { { '-', function() require('nvim-tree.api').tree.open({ current_window = true, path = vim.fn.expand('%:p:h'), }) end, desc = 'NvimTree: open containing directory', }, { 'gt', function() require('nvim-tree.api').tree.toggle() end, desc = 'NvimTree: toggle', }, }, }, { 'nvim-treesitter/nvim-treesitter', lazy = false, build = ':TSUpdateSync', config = function(_, opts) local tsconf = require('nvim-treesitter.parsers').get_parser_configs() tsconf.gotmpl = { install_info = { url = 'https://github.com/ngalaiko/tree-sitter-go-template', files = { 'src/parser.c' }, }, filetype = 'gotmpl', used_by = { 'gotmpl.html', 'gotmpl.yaml', 'gotmpl' }, } require('nvim-treesitter.configs').setup(opts) end, opts = { ensure_installed = { 'bash', 'bibtex', 'c', 'c_sharp', 'cpp', 'cmake', 'comment', 'css', 'dockerfile', 'go', 'gomod', 'gowork', 'hcl', 'html', 'java', 'javascript', 'json', 'jsonc', 'latex', 'ledger', 'lua', 'make', 'markdown', 'markdown_inline', 'ninja', 'norg', 'query', 'regex', 'rust', 'scss', 'toml', 'typescript', 'vim', 'vimdoc', 'yaml', 'zig', 'yuck', -- eww -- experimental 'hare', 'gotmpl', }, highlight = { enable = true, additional_vim_regex_highlighting = { 'markdown' }, }, indent = { enable = true, }, incremental_selection = { enable = true, keymaps = { init_selection = 'gnn', node_incremental = 'grn', node_decremental = 'grm', }, }, refactor = { navigation = { enable = true, keymaps = { goto_definition = '', }, }, smart_rename = { enable = true, keymaps = { smart_rename = 'grr', }, }, }, textobjects = { select = { enable = true, keymaps = { ['ib'] = '@block.inner', ['ob'] = '@block.outer', ['ic'] = '@conditional.inner', ['oc'] = '@conditional.outer', ['if'] = '@function.inner', ['of'] = '@function.outer', ['il'] = '@loop.inner', ['ol'] = '@loop.outer', ['is'] = '@scopename.inner', ['os'] = '@scopename.outer', }, }, }, }, }, { 'nvim-treesitter/nvim-treesitter-refactor', keys = { '', 'grr' } }, { 'nvim-treesitter/nvim-treesitter-textobjects', keys = { 'ib', 'ob', 'ic', 'oc', 'if', 'of', 'il', 'ol', 'is', 'os' }, }, { 'nvim-treesitter/playground', cmd = { 'TSPlaygroundToggle', 'TSHighlightCapturesUnderCursor' }, }, { 'neovim/nvim-lspconfig', lazy = false, -- event = 'InsertEnter', priority = 100, dependencies = { { 'nvim-lua/lsp-status.nvim', config = function() local lspstatus = require('lsp-status') lspstatus.config({ diagnostics = false, current_function = false, status_symbol = '', }) lspstatus.register_progress() end, }, }, config = function() require('telescope').load_extension('lsp_handlers') require('internal.lsp').setup() end, }, { 'hrsh7th/nvim-cmp', event = { 'InsertEnter', 'CmdlineEnter' }, dependencies = { -- 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp-document-symbol', 'hrsh7th/cmp-nvim-lsp-signature-help', 'saadparwaiz1/cmp_luasnip', 'f3fora/cmp-spell', }, config = function() local cmp = require('cmp') local luasnip = require('luasnip') cmp.setup({ experimental = { ghost_text = { hl_group = 'NonText' }, native_menu = false, }, -- disable completion in comments enabled = function() local ok, enable = pcall(function() local ctx = require('cmp.config.context') if vim.api.nvim_get_mode().mode == 'i' then if ctx.in_treesitter_capture('comment') or ctx.in_syntax_group('Comment') then return false end if vim.opt.filetype:get() == 'TelescopePrompt' then return false end end return true end) return not ok or enable end, -- performance = { -- max_view_entries = 20, -- }, preselect = cmp.PreselectMode.Item, window = { completion = { scrollbar = true, border = 'none', }, documentation = { border = 'solid', }, }, completion = { autocomplete = false, }, sorting = { comparators = { cmp.config.compare.offset, cmp.config.compare.exact, cmp.config.compare.recently_used, require("clangd_extensions.cmp_scores"), cmp.config.compare.kind, cmp.config.compare.sort_text, cmp.config.compare.length, cmp.config.compare.order, }, }, mapping = { [''] = cmp.mapping.complete({ reason = cmp.ContextReason.Auto }), [''] = cmp.mapping.complete({ reason = cmp.ContextReason.Auto }), [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping.select_next_item({ behavior = require('cmp.types').cmp.SelectBehavior.Select }), [''] = cmp.mapping.select_prev_item({ behavior = require('cmp.types').cmp.SelectBehavior.Select }), [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping(function(fallback) if cmp.visible() then -- NOTE: poor mans replacement for cmp.confirm without expanding snippet cmp.select_next_item({ behavior = require('cmp.types').cmp.SelectBehavior.Insert }) cmp.close() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if luasnip.expand_or_locally_jumpable() then luasnip.expand_or_jump() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() end end, { 'i', 's' }), -- map c-j/k for luasnip choice nodes [''] = cmp.mapping(function(fallback) if luasnip.choice_active() then luasnip.change_choice(1) else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if luasnip.choice_active() then luasnip.change_choice(-1) else fallback() end end, { 'i', 's' }), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'nvim_lsp_signature_help' }, { name = 'luasnip' }, { name = 'nvim_lua' }, }, { -- { name = 'neorg' }, -- { name = 'orgmode' }, { name = 'spell', keyword_length = 3, max_item_count = 5 }, { name = 'path' }, -- { name = 'buffer', keyword_length = 3 }, }), formatting = { fields = { 'kind', 'abbr', 'menu' }, format = function(entry, item) local menus = { nvim_lsp = '░ lsp', luasnip = '░ snip', nvim_lua = '░ nvim', -- orgmode = '░ org', spell = '░ spell', path = '░ path', buffer = '░ buf', } item.kind = require('internal.lsp_symbols')[item.kind] or '' item.menu = menus[entry.source.name] local maxw = vim.api.nvim_win_get_width(0) - 25 item.abbr = string.sub(item.abbr, 1, (#item.abbr > maxw) and maxw or #item.abbr) return item end, expandable_indicator = true, }, }) cmp.setup.cmdline({ '/', '?', '@' }, { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'nvim_lsp_document_symbol' }, -- { name = 'buffer' } }), formatting = { fields = { 'abbr', 'menu' }, }, }) cmp.setup.cmdline(':', { mapping = { [''] = cmp.mapping({ c = function() vim.cmd.Telescope('command_history') end, }), [''] = cmp.mapping({ c = cmp.mapping.select_next_item({ behavior = require('cmp.types').cmp.SelectBehavior.Insert }), }), [''] = cmp.mapping({ c = cmp.mapping.select_prev_item({ behavior = require('cmp.types').cmp.SelectBehavior.Insert }), }), }, sources = cmp.config.sources({ { name = 'path' }, }, { { name = 'cmdline' }, }), formatting = { fields = { 'abbr', 'menu' }, }, }) -- insert `(` after selecting function/method items cmp.event:on( 'confirm_done', require('nvim-autopairs.completion.cmp').on_confirm_done({ map_char = { tex = '' }, }) ) end, }, { 'L3MON4D3/LuaSnip', config = function() require('internal.snips') end, }, { 'nvim-telescope/telescope.nvim', cmd = 'Telescope', dependencies = { 'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', config = function() require('telescope').load_extension('fzf') end, }, { 'nvim-telescope/telescope-ui-select.nvim', config = function() require('telescope').load_extension('ui-select') end, }, 'gbrlsnchs/telescope-lsp-handlers.nvim', }, config = function() require('telescope').setup({ defaults = { prompt_prefix = '', selection_caret = '⯈ ', sorting_strategy = 'ascending', preview = false, results_title = false, layout_strategy = 'bottom_pane', layout_config = { -- preview_cutoff = 1, -- height = 20, }, border = true, borderchars = { preview = { '─', '│', '─', '│', '┌', '┐', '┘', '└' }, prompt = { '─', '', '', '', '╾', '╼', '', '' }, results = { '' }, }, file_previewer = require('telescope.previewers').vim_buffer_cat.new, grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new, qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new, mappings = { i = { [''] = require('telescope.actions.layout').toggle_preview, }, n = { [''] = require('telescope.actions.layout').toggle_preview, [';'] = function() vim.cmd.Telescope('resume') end, }, }, }, pickers = { buffers = { sort_mru = true, mappings = { i = { [""] = require('telescope.actions').delete_buffer, } } } }, extensions = { ['fzf'] = { fuzzy = true, override_generic_sorter = true, override_file_sorter = true, case_mode = 'smart_case', }, ['lsp_handlers'] = { disable = { -- ['textDocument/codeAction'] = true, }, }, ['ui-select'] = { require('telescope.themes').get_cursor({ initial_mode = 'normal', previewer = false, }), }, }, }) end, keys = { { ';Q', function() require('telescope.builtin').quickfix() end, desc = 'quickfix', }, { ';C', function() require('telescope.builtin').loclist() end, desc = 'loclist', }, { ';H', function() require('telescope.builtin').help_tags() end, desc = 'help_tags', }, { ';b', function() require('telescope.builtin').buffers() end, desc = 'buffer', }, { ';c', function() require('telescope.builtin').commands() end, desc = 'commands', }, { ';f', function() require('telescope.builtin').fd() end, desc = 'fd', }, { ';g', function() require('telescope.builtin').live_grep() end, desc = 'grep', }, { ';h', function() require('telescope.builtin').command_history() end, desc = 'command history', }, { ';bf', function() require('telescope.builtin').current_buffer_fuzzy_find() end, desc = 'buffer', }, { ';o', function() require('telescope.builtin').oldfiles() end, desc = 'oldfiles', }, { ';d', function() require('telescope.builtin').diagnostics() end, desc = 'diagnostics', }, { ';j', function() require('telescope.builtin').jumplist() end, desc = 'jumplist', }, { ';v', function() require('telescope.builtin').find_files({ prompt_title = 'vimrc', previewer = false, search_dirs = { vim.fn.stdpath('config'), vim.fn.stdpath('data') .. '/lazy', } }) end, desc = 'vim config', }, { 'gw', function() require('internal.cursor').word(function(s) require('telescope.builtin').grep_string({ search = s }) end) end, desc = 'grep for word under cursor', }, }, }, { 'norcalli/nvim-colorizer.lua', lazy = false, config = function() require('colorizer').setup(nil, { name = true, RRGGBB = true, RRGGBBAA = false, rgb_fn = true, hsl_fn = true, mode = 'background', }) end, build = [[git cherry-pick patch]], }, { 'gentoo/gentoo-syntax', lazy = false }, { 'NMAC427/guess-indent.nvim', lazy = false, opts = { auto_cmd = true, filetype_exclude = { 'netrw', 'tutor', 'dirbuf', 'nvimtree' }, buftype_exclude = { 'help', 'nofile', 'terminal', 'prompt' }, }, }, { 'echasnovski/mini.align', version = false, opts = {}, keys = { 'ga', 'gA' } }, { url = 'https://git.sr.ht/~robertgzr/spinner.nvim', opts = { spinner = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' }, interval = 120, -- spinner frame rate in ms }, }, { 'stevearc/aerial.nvim', cmd = { 'AerialOpen', 'AerialToggle' }, keys = { { '', vim.cmd.AerialToggle, desc = 'Toggle aerial' } }, opts = { backends = { 'lsp', 'treesitter', 'markdown' }, filter_kind = { -- default: 'Class', 'Constructor', 'Enum', 'Function', 'Interface', 'Module', 'Method', 'Struct', -- custom: 'Constant', 'Variable', }, icons = require('internal.lsp_symbols'), close_automatic_events = { 'unsupported' }, placement = 'edge', open_automatic = false, -- open_automatic = function(bufnr) -- return vim.api.nvim_buf_line_count(bufnr) > 200 -- and package.loaded.aerial.num_symbols(bufnr) > 4 -- and not package.loaded.aerial.was_closed() -- end, default_keybinds = false, show_guides = true, }, }, { 'SmiteshP/nvim-navic', opts = { icons = require('internal.lsp_symbols'), }, }, -- {'kosayoda/nvim-lightbulb', -- config = { -- ignore = {'null-ls'}, -- sign = { enabled = false }, -- virtual_text = { enabled = false, text = '← 󰌵' }, -- status_text = { enabled = true, text = '󰌵', text_unavailable = '' }, -- autocmd = { enabled = true }, -- }, -- init = function() -- vim.fn.sign_define({{name='LightBulbSign', text='󰌵', texthl='LightBulbSign'}}) -- end, -- }, { 'weilbith/nvim-code-action-menu', event = 'VeryLazy', config = function() vim.lsp.handlers['textDocument/codeAction'] = require('code_action_menu').open_code_action_menu end, }, { 'jose-elias-alvarez/null-ls.nvim', enabled = false, ft = { 'sh', 'bash', 'lua', 'rust', 'c', 'cpp', 'css', 'scss', 'html', 'javascript', 'markdown', }, dependencies = { 'nvim-lua/plenary.nvim' }, config = function() local nls = require('null-ls') local nls_h = require('null-ls.helpers') local beautifier = nls_h.make_builtin({ name = 'beautifier', method = nls.methods.FORMATTING, generator_opts = { args = { '--file', '-', '--editorconfig' }, to_stdin = true, }, env = { ['PATH'] = (vim.env.HOME .. '/.yarn/bin') .. ':' .. vim.env.PATH, }, factory = nls_h.formatter_factory, }) nls.setup({ debug = true, on_attach = require('internal.lsp').my_attach, sources = { nls.builtins.diagnostics.shellcheck, nls.builtins.formatting.shfmt, -- nls.builtins.formatting.yapf, -- python nls.builtins.formatting.clang_format, nls.builtins.formatting.rustfmt, nls.builtins.formatting.stylua, -- nls.builtins.formatting.gofumpt, -- nls.builtins.formatting.json_tool, -- nls.builtins.formatting.mdformat, -- custom sources beautifier.with({ filetypes = { 'html', 'gotmpl.html' }, command = 'html-beautify' }), beautifier.with({ filetypes = { 'css', 'scss' }, command = 'css-beautify' }), beautifier.with({ filetypes = { 'javascript' }, command = 'js-beautify' }), }, }) end, }, { 'mfussenegger/nvim-dap', dependencies = { 'nvim-telescope/telescope-dap.nvim', 'rcarriga/nvim-dap-ui', }, config = function() require('telescope').load_extension('dap') require('internal.dap') end, keys = { 'd', }, }, { 'farmergreg/vim-lastplace', event = 'VeryLazy' }, -- restore last cursor position (and handle many edge cases) { 'tpope/vim-surround', event = 'VeryLazy' }, { 'tpope/vim-repeat', event = 'VeryLazy' }, -- extend '.' to plugins { 'michaeljsmith/vim-indent-object', event = 'VeryLazy' }, -- indentation text-objects -- {'kshenoy/vim-signature'}, -- toggle, display and navigate marks -- {'rhysd/conflict-marker.vim'}, -- {'kassio/neoterm'}, { 'kristijanhusak/orgmode.nvim', ft = 'org', build = function() require('orgmode').setup_ts_grammar() vim.cmd.TSUpdate() end, opts = { org_agenda_files = { vim.env.HOME .. '/documents/org/*.org' }, org_default_notes_file = vim.env.HOME .. '/documents/org/todo.org', org_todo_keywords = { 'TODO', 'DONE' }, -- org_indent_mode = 'noindent', org_agenda_templates = { t = { description = 'Todo', template = '* TODO %?', }, n = { description = 'Note', template = '* %?', target = vim.env.HOME .. '/documents/org/notes.org', }, }, mappings = { agenda = { org_agenda_close = nil, }, }, }, -- keys = { -- { mode = 's', ';O', function() -- local pickers = require('telescope.pickers') -- local finders = require('telescope.finders') -- pickers.new(opts, { -- prompt_title = 'Orgmode', -- finder = finders.new_table(require('orgmode.config'):get_all_files()), -- }):find() -- end }, -- }, }, { 'nvim-neorg/neorg', enabled = false, ft = 'norg', cmd = { 'Neorg' }, build = ':Neorg sync-parsers', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-neorg/neorg-telescope', 'nvim-treesitter/nvim-treesitter', }, init = function() -- vim.cmd [[autocmd BufRead,BufNewFile *.norg setlocal filetype=norg]], end, opts = { load = { ['core.defaults'] = {}, ['core.keybinds'] = { config = { default_keybinds = true }, }, ['core.norg.concealer'] = { config = { icons = { todo = { enabled = true } } }, }, ['core.norg.dirman'] = { config = { workspaces = { default = '$HOME/documents/neorg/default', work = '$HOME/documents/neorg/work', gtd = '$HOME/documents/neorg/gtd', }, }, }, ['core.norg.completion'] = { config = { engine = 'nvim-cmp' }, }, ['core.integrations.telescope'] = {}, ['core.norg.qol.todo_items'] = {}, ['core.presenter'] = {}, ['core.gtd.base'] = { config = { workspace = 'gtd' }, }, }, }, }, { 'zk-org/zk-nvim', cmd = { 'ZkNew', 'ZkNotes' }, ft = { 'markdown', 'neorg' }, config = function() require('telescope').load_extension('zk') require('zk').setup({ picker = 'telescope', lsp = { config = { cmd = { 'zk', 'lsp', '--log', '/tmp/zk-lsp.log' }, on_attach = require('internal.lsp').my_attach, on_exit = require('internal.lsp').my_exit, capabilities = require('internal.lsp').capabilities(), }, auto_attach = { enabled = true, filetypes = { 'markdown' }, }, }, }) end, keys = { { ';zn', vim.cmd.ZkNotes, desc = 'zk notes', }, { ';zb', vim.cmd.ZkBacklinks, desc = 'zk backlinks', }, { ';zt', vim.cmd.ZkTags, desc = 'zk tags', }, { ';zl', vim.cmd.ZkLinks, desc = 'zk links', }, { ';zN', function() end, desc = 'zk new note', }, }, }, -- {'rhysd/vim-grammarous', -- ft = {'markdown', 'latex', 'tex'} -- }, { 'lervag/vimtex', enabled = false, ft = { 'latex', 'tex' }, config = function() local g = vim.g g.tex_flavor = 'latex' g.vimtex_compiler_enabled = 0 g.vimtex_compiler_method = 'tectonic' g.vimtex_compiler_tectonic = "{'executable': 'tectonic'}" g.vimtex_view_method = 'zathura' end, }, { 'preservim/vim-markdown', ft = 'markdown', enabled = true, config = function() vim.g.vim_markdown_frontmatter = 0 -- handled by tre-sitter vim.g.vim_markdown_strikethrough = 1 vim.g.vim_markdown_conceal_code_blocks = 0 -- doesn't work due to tree-sitter: https://github.com/nvim-treesitter/nvim-treesitter/issues/2825 vim.g.vim_markdown_no_default_key_mappings = 1 end, }, { 'https://git.sr.ht/~p00f/clangd_extensions.nvim', }, { 'folke/zen-mode.nvim', dependencies = { { 'folke/twilight.nvim', opts = { context = 15, dimming = { alpha = 0.3, color = { 'Normal', '#ffffff' }, }, }, }, }, cmd = { 'ZenMode' }, opts = { window = { -- backdrop = 1, -- width = 0.3, -- height = 1, options = { number = false, list = false, }, }, plugins = { options = { enabled = true, ruler = false, showcmd = false, }, twilight = { enabled = true }, gitsigns = { enabled = false }, }, }, }, { 'folke/which-key.nvim', event = 'VeryLazy', opts = { icons = { separator = '→ ', group = '🞱 ' }, triggers = { '', '', ';', 'g', '[', ']' }, }, }, { 'goolord/alpha-nvim', enabled = false, cmd = 'Alpha', config = function() local MAX_WIDTH = 80 local alpha = require('alpha') local them = require('alpha.themes.theta') local button = function(...) local b = require('alpha.themes.dashboard').button(...) b.opts = vim.tbl_extend('force', b.opts, { hl = 'Normal', width = MAX_WIDTH, }) return b end local fit_path = function(path, max_width) local Path = require('plenary.path') path = vim.fn.fnamemodify(path, ':.') if vim.fn.strdisplaywidth(path) > max_width then path = Path.new(path):shorten(1, { -2, -1 }) end if vim.fn.strdisplaywidth(path) > max_width then path = '_ ' .. path:sub((vim.fn.strdisplaywidth(path) - max_width), -1) end return path end local hr = function(margin, max_width, label, opts) max_width = max_width - (2 * margin) label = label and (' ' .. label .. ' ') or '' opts = vim.tbl_extend('force', opts or {}, { position = 'center', hl = 'Comment' }) return { type = 'text', opts = opts, val = function() local label_len = vim.fn.strdisplaywidth(label) -- exit here if we're not showing a label if label_len == 0 then return string.rep(' ', margin) .. string.rep('─', max_width) .. string.rep(' ', margin) end if label_len > max_width then return error('overfull box: ' .. label) end max_width = max_width - label_len return string.rep(' ', margin) .. string.rep('─', max_width / 2) .. label .. string.rep('─', max_width / 2) .. string.rep(' ', margin) end, } end local fortune = function(margin, max_width) max_width = max_width - (margin * 2) -- local Job = require('plenary.job') -- local ok, j = pcall(Job.new, Job, { -- command = 'sh', -- args = {'-c', 'fortune ' .. vim.env.HOME..'/devel/projects/zig/fortune/fortunes' .. ' | fmt -w ' .. max_width}, -- enable_recording = true, -- }) -- if not ok then return {} end -- local lines, exit_code = j:sync() -- if not exit_code == 0 then return {} end -- local val = {} -- for i = 1, #lines do -- if vim.fn.strdisplaywidth(lines[i]) > max_width then -- return error('overful box: ' .. lines[i]) -- end -- table.insert(val, -- (string.rep(' ', margin) .. lines[i] .. string.rep(' ', margin))) -- end -- if vim.trim(val[#val]) == '' then table.remove(val, #val) end return { type = 'text', val = 'noop', opts = { position = 'center', hl = 'AlphaFortune', }, } end local mru = function(max_width) return { type = 'group', val = function() local items = {} -- initialize the oldfiles table local oldfiles = {} local cwd = vim.uv.cwd() for _, v in pairs(vim.v.oldfiles) do if #oldfiles == 10 then break end if vim.startswith(v, cwd) and (vim.fn.filereadable(v) == 1) then table.insert(oldfiles, v) end end -- exit early if there's nothing to show if not oldfiles or #oldfiles == 0 then return {} end table.insert(items, hr(0, max_width, 'MRU: ' .. fit_path(cwd, max_width))) table.insert(items, { type = 'padding', val = 1 }) for i, fn in pairs(oldfiles) do table.insert( items, button( tostring(i - 1), -- keybind is fit_path(fn, max_width), ':edit ' .. fn .. ' ' ) ) end return items end, opts = { position = 'center', }, } end local buffers = function(max_width) return { type = 'group', val = function() local items = {} -- get listed buffers local bufnrs = vim.tbl_filter(function(bufnr) if 1 ~= vim.fn.buflisted(bufnr) then return false end return true end, vim.api.nvim_list_bufs()) --sort by last_used table.sort(bufnrs, function(a, b) return vim.fn.getbufinfo(a)[1].lastused > vim.fn.getbufinfo(b)[1].lastused end) -- exit early if there's nothing to show if not bufnrs or #bufnrs == 0 then return {} end table.insert(items, { type = 'padding', val = 1 }) table.insert(items, hr(0, max_width, 'Buffers')) table.insert(items, { type = 'padding', val = 1 }) for _, bufnr in ipairs(bufnrs) do local bufpath = require('plenary.path').new(vim.fn.getbufinfo(bufnr)[1].name):shorten(1, { -2, -1 }) table.insert(items, button('b' .. bufnr, bufpath, ':b' .. bufnr .. '')) end return items end, opts = { position = 'center', }, } end them.config.layout = { { type = 'padding', val = 2 }, require('alpha.themes.dashboard').section.header, { type = 'padding', val = 1 }, fortune(5, MAX_WIDTH), { type = 'padding', val = 1 }, hr(0, MAX_WIDTH), { type = 'padding', val = 1 }, { type = 'group', val = { button('e', '󰈔 new', [[ene startinsert]]), button('r', '󰈸 live grep', [[lua require('internal.misc').live_grep()]]), button('f', '󰝰 find files', [[lua require('internal.misc').find_files()]]), button('m', '󰥔 mru', [[lua require('telescope.builtin').oldfiles()]]), button( 'o', '󰃶 orgmode', [[lua require('orgmode').action('agenda.prompt')]] ), button( 't', '󰃶 todos', [[lua require('telescope._extensions.todo-comments').exports.todo {cwd=vim.env.ZK_NOTEBOOK_DIR}]] ), button('u', '󰚰 update plugins', [[lua require('lazy').update()]]), button( 'v', '󰂓 edit config', [[lua require('telescope.builtin').find_files {search_dirs={vim.env.HOME..'/.vim/'}}]] ), }, }, { type = 'padding', val = 1 }, mru(MAX_WIDTH), buffers(MAX_WIDTH), } alpha.setup(them.config) end, keys = { { 'a', vim.cmd.Alpha, desc = 'alpha' }, }, }, { 'linrongbin16/gitlinker.nvim', cmd = { 'GitLink' }, dependencies = { 'nvim-lua/plenary.nvim' }, opts = { message = true, }, keys = { { 'gl', vim.cmd.GitLink, desc = 'gitlinker -> clipboard', }, }, }, { 'rhysd/git-messenger.vim', cmd = { 'GitMessenger' }, config = function() -- vim.g.git_messenger_include_diff = false vim.g.git_messenger_always_into_popup = true vim.g.git_messenger_close_on_cursor_moved = true vim.g.git_messenger_no_default_mappings = true end, keys = { { 'gb', vim.cmd.GitMessenger, desc = 'blame (git-messenger)' }, }, }, { 'folke/todo-comments.nvim', lazy = false, cmd = { 'TodoTelescope' }, config = { keywords = { FIX = { icon = '󰃤' }, TODO = { icon = '󰸞' }, HACK = { icon = '󰈸' }, WARN = { icon = '󱇎' }, PERF = { icon = '󰅒' }, NOTE = { icon = '󰐃' }, TEST = { icon = '󰂓' }, }, search = { pattern = [[\b(KEYWORDS)(|\(.+\)):]], }, highlight = { keyword = "bg", pattern = [[(KEYWORDS)]], } }, keys = { { ';t', vim.cmd.TodoTelescope, desc = 'todo-comments' }, { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, }, }, { 'cbochs/grapple.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, cmd = { 'GrapplePopup' }, opts = { icons = false, popup_options = { border = 'none', }, }, keys = { { 'ml', function() require('grapple').toggle_tags() end, desc = 'grapple: show tags', }, { 'ms', function() require('grapple').popup_scopes() end, desc = 'grapple: show scopes', }, { 'mm', function() require('grapple').toggle() end, desc = 'grapple: anonymous tag', }, { 'mn', function() require('grapple').cycle_forward() end, desc = 'grapple: next tag', }, { 'mp', function() require('grapple').cycle_backward() end, desc = 'grapple: prev tag', }, }, }, { 'tjdevries/sg.nvim', enabled = false, lazy = false, build = 'cargo build --workspace', dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('sg').setup({ on_attach = require('internal.lsp').my_attach, }) end, keys = { { 's', function() require('sg.telescope').fuzzy_search_results() end, desc = 'sg.nvim: fuzzy search results', }, }, }, { url = 'https://git.sr.ht/~robertgzr/karafuru', dev = true, lazy = false, enabled = false, priority = 1000, cond = (vim.opt.background:get() == 'dark'), config = function(plugin) vim.opt.rtp:append(plugin.dir .. '/vim') vim.cmd.colorscheme('karafuru') end, }, { 'yorik1984/newpaper.nvim', lazy = false, enabled = false, priority = 1000, cond = (vim.opt.background:get() == 'light'), config = function() vim.cmd.colorscheme('newpaper') end, }, { 'nyoom-engineering/oxocarbon.nvim', lazy = false, enabled = false, priority = 1000, cond = (vim.opt.background:get() == 'dark'), config = function() vim.opt.background = 'dark' vim.cmd.colorscheme('oxocarbon') end, }, { 'mcchrish/zenbones.nvim', dependencies = { 'rktjmp/lush.nvim' }, lazy = false, enabled = false, priority = 1000, config = function() vim.opt.termguicolors = true local scheme = 'tokyobones' vim.g[scheme] = { lighten_non_text = 20, transparent_background = (vim.opt.background:get() == 'dark'), } vim.cmd.colorscheme(scheme) end, }, -- quarantine { 'zbirenbaum/copilot.lua', enabled = false, cmd = { 'Copilot' }, opts = { panel = { auto_refresh = true }, suggestion = { auto_trigger = true }, }, }, { 'Kicamon/markdown-table-mode.nvim', enabled = true, ft = { 'markdown' }, }, } require('lazy').setup(pluginspec, { defaults = { lazy = true }, dev = { path = '~/src' }, })