diff --git a/.chezmoiignore b/.chezmoiignore index 3921257..25fe76a 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -10,6 +10,8 @@ LICENSE .config/openbox/* .config/nvim/after {{ else }} -lazyvim.json -stylua.toml +.config/nvim/lazyvim.json +.config/nvim/stylua.toml +.config/nvim/lua/config +.config/nvim/lua/plugins/core.lua {{ end }} diff --git a/dot_config/nvim/after/ftplugin/tex.lua b/dot_config/nvim/after/ftplugin/tex.lua deleted file mode 100644 index aca76a7..0000000 --- a/dot_config/nvim/after/ftplugin/tex.lua +++ /dev/null @@ -1,26 +0,0 @@ -vim.g.tex_flavor = "latex" - -vim.opt_local.conceallevel = 2 --- vim.opt_local.spell = true -vim.opt_local.wrap = true - -require("nvim-surround").buffer_setup({ - surrounds = { - ['"'] = { - add = { "``", "''" }, - find = "``.-''", - delete = "^(``)().-('')()$", - }, - ["$"] = { - add = { "\\(", "\\)" }, - find = "\\%(.-\\%)", - delete = "^(\\%()().-(\\%))()$", - change = { - target = "^\\(%()().-(\\%))()$", - replacement = function() - return { { "[", "\t" }, { "", "\\]" } } - end, - }, - }, - }, -}) diff --git a/dot_config/nvim/after/plugin/cmp.lua b/dot_config/nvim/after/plugin/cmp.lua deleted file mode 100644 index 01f483e..0000000 --- a/dot_config/nvim/after/plugin/cmp.lua +++ /dev/null @@ -1,85 +0,0 @@ -local ok, cmp = pcall(require, 'cmp') -if not ok then - return -end - -require('luasnip.loaders.from_vscode').lazy_load() - -local luasnip = require('luasnip') -local lspkind = require('lspkind') -local select_opts = {behavior = cmp.SelectBehavior.Select} - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - sources = { - {name = 'path'}, - {name = 'nvim_lsp', keyword_length = 1}, - {name = 'buffer', keyword_length = 3}, - {name = 'luasnip', keyword_length = 2}, - }, - window = { - documentation = cmp.config.window.bordered() - }, - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol_text', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - }) - }, - mapping = { - [''] = cmp.mapping.select_prev_item(select_opts), - [''] = cmp.mapping.select_next_item(select_opts), - - [''] = cmp.mapping.select_prev_item(select_opts), - [''] = cmp.mapping.select_next_item(select_opts), - - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({select = true}), - [''] = cmp.mapping.confirm({select = false}), - - [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(1) then - luasnip.jump(1) - else - fallback() - end - end, {'i', 's'}), - - [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, {'i', 's'}), - - [''] = cmp.mapping(function(fallback) - local col = vim.fn.col('.') - 1 - - if cmp.visible() then - cmp.select_next_item(select_opts) - elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - fallback() - else - cmp.complete() - end - end, {'i', 's'}), - - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item(select_opts) - else - fallback() - end - end, {'i', 's'}), - }, -}) - - diff --git a/dot_config/nvim/after/plugin/lsp.lua.tmpl b/dot_config/nvim/after/plugin/lsp.lua.tmpl deleted file mode 100644 index 769c630..0000000 --- a/dot_config/nvim/after/plugin/lsp.lua.tmpl +++ /dev/null @@ -1,220 +0,0 @@ -local ok, lsp = pcall(require, 'lspconfig') -if not ok then - return -end - -{{- if ne .chezmoi.os "openbsd" }} --- See :help mason-settings -require('mason').setup({ - ui = { border = 'rounded' } -}) - --- See :help mason-lspconfig-settings -require('mason-lspconfig').setup({ - ensure_installed = { - 'clangd', - 'gopls', - 'ltex', - 'marksman', - 'svelte', - 'tsserver', - 'eslint', - 'html', - 'cssls', - 'lua_ls' - } -}) -{{- end }} - -local lsp_defaults = lsp.util.default_config - -lsp_defaults.capabilities = vim.tbl_deep_extend( - 'force', - lsp_defaults.capabilities, - require('cmp_nvim_lsp').default_capabilities() -) - -local sign = function(opts) - -- See :help sign_define() - vim.fn.sign_define(opts.name, { - texthl = opts.name, - text = opts.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 -}) - -require("lsp-format").setup { - html = { - exclude = { "html" } - }, - svelte = { - exclude = { "svelte" } - } -} - -{{- if ne .chezmoi.os "openbsd" }} -local group = vim.api.nvim_create_augroup('lsp_cmds', { clear = true }) - -vim.api.nvim_create_autocmd('LspAttach', { - group = group, - desc = 'LSP actions', - callback = function(args) - local bufmap = function(mode, lhs, rhs) - local opts = { buffer = true } - vim.keymap.set(mode, lhs, rhs, opts) - end - local client = vim.lsp.get_client_by_id(args.data.client_id) - require("lsp-format").on_attach(client) - - 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', '', 'lua vim.lsp.buf.rename()') - bufmap('n', '', 'lua vim.lsp.buf.format({async = true})') - bufmap('n', '', 'lua vim.lsp.buf.code_action()') - bufmap('x', '', 'lua vim.lsp.buf.range_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 -}) - -require('mason-lspconfig').setup_handlers({ - function(server) - lsp[server].setup({}) - end, - ['tsserver'] = function() - lsp.tsserver.setup({ - settings = { - completions = { - completeFunctionCalls = true - } - } - }) - end, - ['lua_ls'] = function() - lsp.lua_ls.setup({ - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - }, - } - } - }) - end, - ['gopls'] = function() - lsp.gopls.setup({ - settings = { - gopls = { - analyses = { - unusedparams = true, - unusedvariable = true, - shadow = true - }, - staticcheck = true, - }, - } - }) - end, -}) -{{- else }} -local on_attach = function(client) - local bufmap = function(mode, lhs, rhs) - local opts = {buffer = true} - vim.keymap.set(mode, lhs, rhs, opts) - end - require("lsp-format").on_attach(client) - - 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', '', 'lua vim.lsp.buf.rename()') - bufmap('n', '', 'lua vim.lsp.buf.format({async = true})') - bufmap('n', '', 'lua vim.lsp.buf.code_action()') - bufmap('x', '', 'lua vim.lsp.buf.range_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 = { - analyses = { - unusedparams = true, - unusedvariable = true, - shadow = true - }, - staticcheck = true, - }, - }, - on_attach = on_attach -} -lsp.clangd.setup { 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.tsserver.setup { on_attach = on_attach } -lsp.lua_ls.setup { - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - }, - } - }, - on_attach = on_attach -} -{{- end }} diff --git a/dot_config/nvim/after/plugin/telekasten.lua b/dot_config/nvim/after/plugin/telekasten.lua deleted file mode 100644 index b8d1955..0000000 --- a/dot_config/nvim/after/plugin/telekasten.lua +++ /dev/null @@ -1,76 +0,0 @@ -local ok, telekasten = pcall(require, 'telekasten') -local home = vim.fn.expand("~/doc/zettelkasten") - -telekasten.setup { - home = home, - take_over_my_home = true, - auto_set_filetype = true, - dailies = home .. '/' .. 'daily', - weeklies = home .. '/' .. 'weekly', - templates = home .. '/' .. 'templates', - image_subdir = "img", - extension = ".md", - new_note_filename = "uuid-title", - uuid_type = "%Y%m%d%H%M", - uuid_sep = "-", - follow_creates_nonexisting = true, - dailies_create_nonexisting = true, - weeklies_create_nonexisting = true, - journal_auto_open = false, - - -- template for new notes (new_note, follow_link) - -- set to `nil` or do not specify if you do not want a template - template_new_note = home .. '/' .. 'templates/new_note.md', - - -- template for newly created daily notes (goto_today) - -- set to `nil` or do not specify if you do not want a template - template_new_daily = home .. '/' .. 'templates/daily.md', - - -- template for newly created weekly notes (goto_thisweek) - -- set to `nil` or do not specify if you do not want a template - template_new_weekly= home .. '/' .. 'templates/weekly.md', - - -- image link style - -- wiki: ![[image name]] - -- markdown: ![](image_subdir/xxxxx.png) - image_link_style = "wiki", - - -- default sort option: 'filename', 'modified' - sort = "filename", - - -- integrate with calendar-vim - plug_into_calendar = true, - calendar_opts = { - weeknm = 4, - calendar_monday = 1, - calendar_mark = 'left-fit', - }, - - close_after_yanking = false, - insert_after_inserting = true, - tag_notation = "#tag", - command_palette_theme = "dropdown", - show_tags_theme = "ivy", - subdirs_in_links = true, - template_handling = "smart", - new_note_location = "smart", - rename_update_links = true, - follow_url_fallback = nil, -} - -local map = vim.keymap.set -map('n',"zf", "Telekasten find_notes") -map('n',"zd", "Telekasten find_daily_notes") -map('n',"zg", "Telekasten search_notes") -map('n',"zz", "Telekasten follow_link") -map('n',"zn", "Telekasten new_note") -map('n',"zr", "Telekasten rename_note") -map('n',"zc", "Telekasten show_calendar") -map('n',"#", "Telekasten show_tags") - -map('n',"z", "Telekasten panel") - -vim.api.nvim_set_hl(0, "tklink", { fg = "#689d6a", bg = "" }) -vim.api.nvim_set_hl(0, "tkBrackets", { fg = "gray", bg = "gray" }) - - diff --git a/dot_config/nvim/after/plugin/telescope.lua b/dot_config/nvim/after/plugin/telescope.lua deleted file mode 100644 index 8ed8247..0000000 --- a/dot_config/nvim/after/plugin/telescope.lua +++ /dev/null @@ -1,34 +0,0 @@ -local ok, telescope = pcall(require, 'telescope') -if not ok then - return -end - -telescope.setup { - 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" - } - } -} - -telescope.load_extension('fzf') -telescope.load_extension('file_browser') - -local map = vim.keymap.set -map('n', "", "Telescope file_browser") -map('n', "", "Telescope current_buffer_tags") - -map('n', "e", "Telescope find_files") -map('n', "f", "Telescope live_grep") -map('n', "b", "Telescope buffers") -map('n', "h", "Telescope help_tags") -map('n', "z=", "Telescope spell_suggest") diff --git a/dot_config/nvim/after/plugin/treesitter.lua b/dot_config/nvim/after/plugin/treesitter.lua deleted file mode 100644 index 78b6ff8..0000000 --- a/dot_config/nvim/after/plugin/treesitter.lua +++ /dev/null @@ -1,94 +0,0 @@ -local ok, treesitter = pcall(require, 'nvim-treesitter.configs') -if not ok then - return -end - - -treesitter.setup { - incremental_selection = { - enable = true, - keymaps = { - -- mappings for incremental selection (visual mappings) - init_selection = "gnn", -- maps in normal mode to init the node/scope selection - node_incremental = "grn", -- increment to the upper named parent - scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) - node_decremental = "grm" -- decrement to the previous node - } - }, - textobjects = { - -- syntax-aware textobjects - enable = true, - lsp_interop = { - enable = true, - peek_definition_code = { - ["DF"] = "@function.outer", - } - }, - keymaps = { - ["iL"] = { - -- you can define your own textobjects directly here - go = "(function_definition) @function", - }, - -- or you use the queries from supported languages with textobjects.scm - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["aC"] = "@class.outer", - ["iC"] = "@class.inner", - ["ac"] = "@conditional.outer", - ["ic"] = "@conditional.inner", - ["ae"] = "@block.outer", - ["ie"] = "@block.inner", - ["al"] = "@loop.outer", - ["il"] = "@loop.inner", - ["is"] = "@statement.inner", - ["as"] = "@statement.outer", - ["ad"] = "@comment.outer", - ["am"] = "@call.outer", - ["im"] = "@call.inner" - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]]"] = "@function.outer", - ["]c"] = { query = "@class.outer", desc = "Next class start" }, - -- - -- You can use regex matching and/or pass a list in a "query" key to group multiple queires. - ["]o"] = "@loop.*", - -- ["]o"] = { query = { "@loop.inner", "@loop.outer" } } - -- - -- You can pass a query group to use query from `queries//.scm file in your runtime path. - -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. - ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, - ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, - }, - goto_next_end = { - ["]["] = "@function.outer", - ["]C"] = "@class.outer", - }, - goto_previous_start = { - ["[["] = "@function.outer", - ["[c"] = "@class.outer", - }, - goto_previous_end = { - ["[]"] = "@function.outer", - ["[C"] = "@class.outer", - } - } - }, - ensure_installed = { - 'javascript', - 'typescript', - 'css', - 'json', - 'c', - 'lua', - 'go' - }, - sync_install = false, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, -} diff --git a/dot_config/nvim/init.lua.tmpl b/dot_config/nvim/init.lua.tmpl index 6bdc699..ccd6029 100644 --- a/dot_config/nvim/init.lua.tmpl +++ b/dot_config/nvim/init.lua.tmpl @@ -1,114 +1,24 @@ {{- 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.cmd([[colorscheme gruvbox]]) vim.g.mapleader = ' ' vim.g.maplocalleader = '\\' -- Plugins -require "paq" { - "savq/paq-nvim", - - "nvim-treesitter/nvim-treesitter", - "nvim-treesitter/nvim-treesitter-textobjects", - - -- Theming - "ellisonleao/gruvbox.nvim", - "nvim-lualine/lualine.nvim", - "nvim-tree/nvim-web-devicons", - "lukas-reineke/indent-blankline.nvim", - - -- LSP support - "onsails/lspkind.nvim", - "lukas-reineke/lsp-format.nvim", - "neovim/nvim-lspconfig", - - -- Autocomplete - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lua", - - -- Snippets - "L3MON4D3/LuaSnip", - "rafamadriz/friendly-snippets", - - -- Programming support - "kylechui/nvim-surround", - "windwp/nvim-autopairs", - "numToStr/Comment.nvim", - "ggandor/leap.nvim", - - -- Fuzzy search - { "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" }, - "nvim-telescope/telescope-file-browser.nvim", - "nvim-telescope/telescope.nvim", - "folke/trouble.nvim", - - "mfussenegger/nvim-dap", - "theHamsta/nvim-dap-virtual-text", - "rcarriga/nvim-dap-ui", - - "norcalli/nvim-colorizer.lua", - "lewis6991/gitsigns.nvim", - "tpope/vim-fugitive", - "renerocksai/telekasten.nvim", - "renerocksai/calendar-vim", - "nvim-lua/plenary.nvim", - "akinsho/toggleterm.nvim", - -} - -require('nvim-web-devicons').setup {} -require('nvim-surround').setup() -require('Comment').setup() -require('dapui').setup() -require('gitsigns').setup() -require("trouble").setup {} -require('nvim-autopairs').setup({ - fast_wrap = {}, - check_ts = true -}) - -require('leap').add_default_mappings() - -require 'colorizer'.setup { - filetypes = { - 'css', - 'javascript', - scss = { rgb_fn = true, }, - html = { mode = 'foreground', } - }, -} - -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'gruvbox', - component_separators = '|', - section_separators = '', - } -} - -require('indent_blankline').setup({ - char = '▏', - show_trailing_blankline_indent = false, - show_first_indent_level = false, - use_treesitter = true, - show_current_context = false -}) - -require('toggleterm').setup({ - open_mapping = '', - direction = 'horizontal', - shade_terminals = true -}) - -require("gruvbox").setup { - contrast = "hard" -} +require("lazy").setup("plugins") -- Options local o = vim.opt @@ -290,12 +200,6 @@ map('n', '', 'resize +2') map('n', '', 'vertical resize -2') map('n', '', 'vertical resize +2') --- Trouble keymap -map('n', 'xx', 'TroubleToggle', { noremap = true, silent = true }) -map('n', 'xd', 'TroubleToggle document_diagnostics', { noremap = true, silent = true }) -map('n', 'xl', 'TroubleToggle loclist', { noremap = true, silent = true }) -map('n', 'xq', 'TroubleToggle quickfix', { noremap = true, silent = true }) - map('n', 'g', 'vertical rightbelow Git', { noremap = true, silent = true }) {{ else }} -- bootstrap lazy.nvim, LazyVim and your plugins diff --git a/dot_config/nvim/lua/plugins/coding.lua b/dot_config/nvim/lua/plugins/coding.lua new file mode 100644 index 0000000..96d3ec4 --- /dev/null +++ b/dot_config/nvim/lua/plugins/coding.lua @@ -0,0 +1,213 @@ +return { + + -- snippets + { + "L3MON4D3/LuaSnip", + build = (not jit.os:find("Windows")) + and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" + or nil, + dependencies = { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + opts = { + history = true, + delete_check_events = "TextChanged", + }, + -- stylua: ignore + keys = { + { + "", + function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, + expr = true, + silent = true, + mode = "i", + }, + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, + }, + + -- 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", + "saadparwaiz1/cmp_luasnip", + }, + opts = function() + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local luasnip = require('luasnip') + local lspkind = require('lspkind') + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_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 = "luasnip", keyword_length = 2 }, + { name = "path" }, + }, { + { name = "buffer", keyword_length = 3 }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol_text', -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + }) + }, + experimental = { + ghost_text = { + hl_group = "CmpGhostText", + }, + }, + sorting = defaults.sorting, + } + end, + config = function(_, opts) + for _, source in ipairs(opts.sources) do + source.group_index = source.group_index or 1 + end + require("cmp").setup(opts) + end, + }, + + -- auto pairs + { + "echasnovski/mini.pairs", + event = "VeryLazy", + opts = {}, + keys = { + { + "up", + function() + local Util = require("lazy.core.util") + vim.g.minipairs_disable = not vim.g.minipairs_disable + if vim.g.minipairs_disable then + Util.warn("Disabled auto pairs", { title = "Option" }) + else + Util.info("Enabled auto pairs", { title = "Option" }) + end + end, + desc = "Toggle auto pairs", + }, + }, + }, + + -- Fast and feature-rich surround actions. For text that includes + -- surrounding characters like brackets or quotes, this allows you + -- to select the text inside, change or modify the surrounding characters, + -- and more. + { + "echasnovski/mini.surround", + keys = function(_, keys) + -- Populate the keys based on the user's options + local plugin = require("lazy.core.config").spec.plugins["mini.surround"] + local opts = require("lazy.core.plugin").values(plugin, "opts", false) + local mappings = { + { opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } }, + { opts.mappings.delete, desc = "Delete surrounding" }, + { opts.mappings.find, desc = "Find right surrounding" }, + { opts.mappings.find_left, desc = "Find left surrounding" }, + { opts.mappings.highlight, desc = "Highlight surrounding" }, + { opts.mappings.replace, desc = "Replace surrounding" }, + { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, + } + mappings = vim.tbl_filter(function(m) + return m[1] and #m[1] > 0 + end, mappings) + return vim.list_extend(mappings, keys) + end, + opts = { + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + replace = "gsr", -- Replace surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + }, + }, + + -- comments + { + "JoosepAlviste/nvim-ts-context-commentstring", + lazy = true, + opts = { + enable_autocmd = false, + }, + }, + { + "echasnovski/mini.comment", + event = "VeryLazy", + opts = { + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo + .commentstring + end, + }, + }, + }, + + -- Better text-objects + { + "echasnovski/mini.ai", + -- keys = { + -- { "a", mode = { "x", "o" } }, + -- { "i", mode = { "x", "o" } }, + -- }, + opts = function() + local ai = require("mini.ai") + return { + n_lines = 500, + custom_textobjects = { + o = ai.gen_spec.treesitter({ + a = { "@block.outer", "@conditional.outer", "@loop.outer" }, + i = { "@block.inner", "@conditional.inner", "@loop.inner" }, + }, {}), + f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), + c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), + t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, + }, + } + end, + config = function(_, opts) + require("mini.ai").setup(opts) + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/colorscheme.lua b/dot_config/nvim/lua/plugins/colorscheme.lua deleted file mode 100644 index 8800c77..0000000 --- a/dot_config/nvim/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,20 +0,0 @@ -return { - -- gruvbox - { - "ellisonleao/gruvbox.nvim", - opts = { contrast = "hard" }, - }, - - -- kanagawa - { - "rebelot/kanagawa.nvim", - }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "kanagawa", - }, - }, -} diff --git a/dot_config/nvim/lua/plugins/colorscheme.tmpl b/dot_config/nvim/lua/plugins/colorscheme.tmpl new file mode 100644 index 0000000..b78ba69 --- /dev/null +++ b/dot_config/nvim/lua/plugins/colorscheme.tmpl @@ -0,0 +1,28 @@ +return { + -- gruvbox + { + "ellisonleao/gruvbox.nvim", + opts = { contrast = "hard" }, + }, + +{{- if eq .chezmoi.os "openbsd" }} + -- kanagawa + { + "rebelot/kanagawa.nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + vim.cmd([[colorscheme kanagawa]]) + end, + }, +{{- else }} + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "kanagawa", + }, + }, +{{- end }} +} diff --git a/dot_config/nvim/lua/plugins/editor.lua b/dot_config/nvim/lua/plugins/editor.lua new file mode 100644 index 0000000..336cbc4 --- /dev/null +++ b/dot_config/nvim/lua/plugins/editor.lua @@ -0,0 +1,270 @@ +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", + "nvim-telescope/telescope-file-browser.nvim", + }, + keys = { + { "", "Telescope file_browser", desc = "File browser" }, + { "e", "Telescope find_files", desc = "Find file" }, + { "b", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { "f", "Telescope live_grep", desc = "Switch Buffer" }, + { "h", "Telescope help_tags", desc = "Search help tags" }, + { "z=", "Telescope spell_suggest", desc = "Spell options" }, + }, + 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, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "gmake", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- 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 = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["gs"] = { name = "+surround" }, + ["]"] = { name = "+next" }, + ["["] = { name = "+prev" }, + [""] = { name = "+tabs" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+code" }, + ["f"] = { name = "+file/find" }, + ["g"] = { name = "+git" }, + ["gh"] = { name = "+hunks" }, + ["q"] = { name = "+quit/session" }, + ["s"] = { name = "+search" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows" }, + ["x"] = { name = "+diagnostics/quickfix" }, + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) + end, + }, + + -- 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" }, + }, + }, + + -- buffer remove + { + "echasnovski/mini.bufremove", + + keys = { + { + "bd", + function() + local bd = require("mini.bufremove").delete + if vim.bo.modified then + local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), + "&Yes\n&No\n&Cancel") + if choice == 1 then -- Yes + vim.cmd.write() + bd(0) + elseif choice == 2 then -- No + bd(0, true) + end + else + bd(0) + end + end, + desc = "Delete Buffer", + }, + -- stylua: ignore + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, + }, + + -- 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" }, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..192c2fd --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,157 @@ +return { + -- lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "onsails/lspkind.nvim", + "lukas-reineke/lsp-format.nvim", + }, + 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, + }, + }, + config = function(_, opts) + local lsp= require('lspconfig') + local lsp_defaults = lsp.util.default_config + + 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 + }) + + require("lsp-format").setup { + html = { + exclude = { "html" } + } + } + +local on_attach = function(client) + local bufmap = function(mode, lhs, rhs) + local opts = {buffer = true} + vim.keymap.set(mode, lhs, rhs, opts) + end + require("lsp-format").on_attach(client) + + 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', '', 'lua vim.lsp.buf.rename()') + bufmap('n', '', 'lua vim.lsp.buf.format({async = true})') + bufmap('n', '', 'lua vim.lsp.buf.code_action()') + bufmap('x', '', 'lua vim.lsp.buf.range_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 = { + analyses = { + unusedparams = true, + unusedvariable = true, + shadow = true + }, + staticcheck = true, + }, + }, + on_attach = on_attach +} +lsp.clangd.setup { 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.tsserver.setup { on_attach = on_attach } +lsp.lua_ls.setup { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + }, + } + }, + on_attach = on_attach + } + end +} +} diff --git a/dot_config/nvim/lua/plugins/notes.lua b/dot_config/nvim/lua/plugins/notes.lua.tmpl similarity index 88% rename from dot_config/nvim/lua/plugins/notes.lua rename to dot_config/nvim/lua/plugins/notes.lua.tmpl index cff6e3a..580a522 100644 --- a/dot_config/nvim/lua/plugins/notes.lua +++ b/dot_config/nvim/lua/plugins/notes.lua.tmpl @@ -9,10 +9,10 @@ return { opts = { take_over_my_home = true, auto_set_filetype = true, - home = "/Users/jan/doc/zettelkasten", - dailies = "/Users/jan/doc/zettelkasten/daily", - weeklies = "/Users/jan/doc/zettelkasten/weekly", - templates = "/Users/jan/doc/zettelkasten/templates", + home = "{{ .home }}/doc/zettelkasten", + dailies = "{{ .home }}/doc/zettelkasten/daily", + weeklies = "{{ .home }}/doc/zettelkasten/weekly", + templates = "{{ .home }}/doc/zettelkasten/templates", image_subdir = "img", extension = ".md", new_note_filename = "uuid-title", @@ -25,15 +25,15 @@ return { -- template for new notes (new_note, follow_link) -- set to `nil` or do not specify if you do not want a template - template_new_note = "/Users/jan/doc/zettelkasten/templates/new_note.md", + template_new_note = "{{ .home }}/doc/zettelkasten/templates/new_note.md", -- template for newly created daily notes (goto_today) -- set to `nil` or do not specify if you do not want a template - template_new_daily = "/Users/jan/doc/zettelkasten/templates/daily.md", + template_new_daily = "{{ .home }}/doc/zettelkasten/templates/daily.md", -- template for newly created weekly notes (goto_thisweek) -- set to `nil` or do not specify if you do not want a template - template_new_weekly = "/Users/jan/doc/zettelkasten/templates/weekly.md", + template_new_weekly = "{{ .home }}/doc/zettelkasten/templates/weekly.md", -- image link style -- wiki: ![[image name]] diff --git a/dot_config/nvim/lua/plugins/treesitter.lua b/dot_config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..bcbbd6a --- /dev/null +++ b/dot_config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,103 @@ +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" }, + 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" }, + 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", + "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..7f0b2b8 --- /dev/null +++ b/dot_config/nvim/lua/plugins/ui.lua @@ -0,0 +1,235 @@ +return { + -- 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 = { + icons_enabled = true, + theme = 'auto', + component_separators = '|', + section_separators = '', + }, + }, + + -- indent guides for Neovim + -- { + -- "lukas-reineke/indent-blankline.nvim", + -- opts = { + -- indent = { + -- char = "│", + -- tab_char = "│", + -- }, + -- scope = { enabled = false }, + -- exclude = { + -- filetypes = { + -- "help", + -- "alpha", + -- "dashboard", + -- "neo-tree", + -- "Trouble", + -- "lazy", + -- "mason", + -- "notify", + -- "toggleterm", + -- "lazyterm", + -- }, + -- }, + -- }, + -- main = "ibl", + -- }, + + -- 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" } + }, + }, + }, + + -- -- lsp symbol navigation for lualine. This shows where + -- in the code structure you are - within functions, classes, + -- etc - in the statusline. + { + "SmiteshP/nvim-navic", + lazy = true, + opts = function() + return { + separator = " ", + highlight = true, + depth_limit = 5, + lazy_update_context = true, + } + end, + }, + + -- icons + { "nvim-tree/nvim-web-devicons", lazy = true }, + + -- ui components + { "MunifTanjim/nui.nvim", lazy = true }, +} diff --git a/dot_mbsyncrc b/dot_mbsyncrc new file mode 100644 index 0000000..c2024c6 --- /dev/null +++ b/dot_mbsyncrc @@ -0,0 +1,142 @@ +################################# +###### Account moebius ########## +################################# + +IMAPAccount moebius +Host mail.moebiusband.org +User jan +PassCmd "keepassxc-cli show /home/jan/doc/private/Passwords.kdbx server/moebiusband.org -a password" +SSLType IMAPS +SSLVersions TLSv1.2 +CertificateFile /etc/ssl/cert.pem + +# Remote storage +IMAPStore moebius-remote +Account moebius + +# Local storage +MaildirStore moebius-local +Path ~/.mail/moebius/ +Inbox ~/.mail/moebius/INBOX + +Channel moebius-inbox +Master :moebius-remote:"INBOX" +Slave :moebius-local:INBOX +Create Both +Expunge Both + +Channel moebius-archive +Master :moebius-remote:"Archive" +Slave :moebius-local:archive +Create Both +Expunge Both + +Channel moebius-drafts +Master :moebius-remote:"Drafts" +Slave :moebius-local:drafts +Create Both +Expunge Both + +Channel moebius-sent +Master :moebius-remote:"Sent" +Slave :moebius-local:sent +Create Both +Expunge Both + +Channel moebius-trash +Master :moebius-remote:"Trash" +Slave :moebius-local:trash +Create Both +Expunge Both + +#Channel moebius-junk +#Master :moebius-remote:"Junk" +#Slave :moebius-local:junk +#Create Both +#Expunge Both + +Group moebius +Channel moebius-inbox +Channel moebius-archive +Channel moebius-drafts +Channel moebius-sent +Channel moebius-trash +#Channel moebius-junk + + +################################# +######## Account fau ############ +################################# + +IMAPAccount fau +Host groupware.fau.de +User fauad\\unrz254 +PassCmd "gopass show sso/rrze" +SSLType STARTTLS +SSLVersions TLSv1.2 +CertificateFile /etc/ssl/cert.pem + +# Remote storage +IMAPStore fau-remote +Account fau + +# Local storage +MaildirStore fau-local +Path ~/.mail/fau/ +Inbox ~/.mail/fau/INBOX + +Channel fau +Master :fau-remote: +Slave :fau-local: +Patterns * !Calendar !Contacts "!Suggested Contacts" +Create Both +SyncState * + +################################# +####### Account gmail ########### +################################# + +IMAPAccount gmail +Host imap.gmail.com +User jan.treibig@gmail.com +PassCmd "keepassxc-cli show /home/jan/doc/private/Passwords.kdbx sso/Google -a password" +SSLType IMAPS +CertificateFile /etc/ssl/cert.pem + +IMAPStore gmail-remote +Account gmail + +MaildirStore gmail-local +Subfolders Verbatim +Path ~/.mail/gmail/ +Inbox ~/.mail/gmail/INBOX + +Channel sync-googlemail-default +Master :gmail-remote: +Slave :gmail-local: +Patterns "INBOX" +Create Slave + +Channel sync-googlemail-sent +Master :gmail-remote:"[Gmail]/Sent Mail" +Slave :gmail-local:sent +Create Slave + +Channel sync-googlemail-archive +Master :gmail-remote:"[Gmail]/All Mail" +Slave :gmail-local:archive +Create Slave + +# Get all the channels together into a group. +Group gmail +Channel sync-googlemail-default +Channel sync-googlemail-sent +Channel sync-googlemail-archive + +#Channel gmail +#Master :gmail-remote: +#Slave :gmail-local: +#Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" +#Sync Pull +#Create Slave +#SyncState * diff --git a/executable_dot_xsession.tmpl b/executable_dot_xsession.tmpl index cc6d77a..5c4926d 100644 --- a/executable_dot_xsession.tmpl +++ b/executable_dot_xsession.tmpl @@ -40,5 +40,6 @@ xidle -timeout 300 -program "/usr/local/bin/slock" & xrdb -merge $HOME/.Xresources xsetroot -solid "#282828" urxvtd -q -f -o +tint2& exec openbox