diff --git a/lua/custom/maps/init.lua b/lua/custom/maps/init.lua index 8522345..f050fff 100644 --- a/lua/custom/maps/init.lua +++ b/lua/custom/maps/init.lua @@ -84,7 +84,8 @@ vim.keymap.set('n', 'wk', 'tabnext', { desc = 'Next [W]orkspace vim.keymap.set('n', 'wj', 'tabprevious', { desc = 'Last [W]orkspace/Tab' }) vim.keymap.set('n', 'n', 'enew', { desc = '[N]ew Buffer' }) -vim.keymap.set('t', '', vim.api.nvim_replace_termcodes('', true, true, true), { desc = 'Leave terminal mode' }) +vim.keymap.set('t', '', vim.api.nvim_replace_termcodes('', true, true, true), + { desc = 'Leave terminal mode' }) -------------------------------------------------------------------------------- -- Editing @@ -133,17 +134,24 @@ vim.keymap.set({ 'v' }, 'fl', ':!fmt -w80', { desc = '[F]ormat long -------------------------------------------------------------------------------- -- format the current buffer vim.keymap.set('n', 'ff', function() - require('conform').format() + require('conform').format() end, { desc = '[F]ormat buffer' }) vim.keymap.set('n', 'fF', function() - vim.lsp.buf.format() + vim.lsp.buf.format() end, { desc = '[F]ormat buffer (no plugin)' }) vim.keymap.set('n', 'fw', function() - require('mini.trailspace').trim() + require('mini.trailspace').trim() end, { desc = '[F]ormat remove [W]hitespace' }) -------------------------------------------------------------------------------- --- Formating +-- Diagnostics +-------------------------------------------------------------------------------- +vim.keymap.set({ 'i', 'n', 'v' }, '', function() + vim.diagnostic.open_float() +end) + +-------------------------------------------------------------------------------- +-- Ignore -------------------------------------------------------------------------------- -- discard F15 vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '', '') diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 45c8b8c..db4d7fa 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,103 +1,104 @@ return { - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin + -- NOTE: Plugins can specify dependencies. + -- + -- The dependencies are proper plugin specifications as well - anything + -- you do for a plugin at the top level, you can do for a dependency. + -- + -- Use the `dependencies` key to specify the dependencies of a particular plugin - { -- Autoformat - 'stevearc/conform.nvim', - lazy = false, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_fallback = true } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = false, cpp = false, json = true, bib = true, markdown = false } - return { - timeout_ms = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], - } - end, - formatters_by_ft = { - ['_'] = { 'prettier' }, - rust = { 'rust-analyzer' }, - lua = { 'stylua' }, - typst = { 'typstyle' }, - json = { 'jq' }, - -- rust = { 'rustfmt' }, -- does not need one with the lsp there - c = { 'clang-format' }, - cpp = { 'clang-format' }, - python = { 'autopep8' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - javascript = { 'prettier' }, - }, - }, - }, - { - 'glacambre/firenvim', - enabled = vim.g.started_by_firenvim, - lazy = false, - build = function() - vim.fn['firenvim#install'](0) - end, - config = function() - vim.g.firenvim_config = { - localSettings = { - ['.*'] = { - filename = '/tmp/{hostname}_{pathname%10}.{extension%5}', - cmdline = 'firenvim', - takeover = 'never', -- can't open it with never at all? - }, - }, - } - end, - }, - { - -- enables UNIX specific stuff in vim, - -- specifically: - -- :SudoWrite - -- :SudoRead - -- :Chmod - -- and also some more, but those are easy done with shell - 'tpope/vim-eunuch', - lazy = false, - }, - { - 'mikesmithgh/kitty-scrollback.nvim', - enabled = true, - lazy = true, - cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth' }, - event = { 'User KittyScrollbackLaunch' }, - -- version = '*', -- latest stable version, may have breaking changes if major version changed - -- version = '^3.0.0', -- pin major version, include fixes and features that do not have breaking changes - config = function() - require('kitty-scrollback').setup { - myconfig = function() - return { keymaps_enabled = false } - end, - } - end, - }, + { -- Autoformat + 'stevearc/conform.nvim', + lazy = false, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = false, cpp = false, json = true, bib = true, markdown = false } + return { + timeout_ms = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + formatters_by_ft = { + ['_'] = { 'prettier' }, + rust = { 'rust-analyzer' }, + lua = { 'stylua' }, + typst = { 'typstyle' }, + json = { 'jq' }, + -- rust = { 'rustfmt' }, -- does not need one with the lsp there + c = { 'clang-format' }, + cpp = { 'clang-format' }, + python = { 'autopep8' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + javascript = { 'prettier' }, + asm = { "asmfmt" } + }, + }, + }, + { + 'glacambre/firenvim', + enabled = vim.g.started_by_firenvim, + lazy = false, + build = function() + vim.fn['firenvim#install'](0) + end, + config = function() + vim.g.firenvim_config = { + localSettings = { + ['.*'] = { + filename = '/tmp/{hostname}_{pathname%10}.{extension%5}', + cmdline = 'firenvim', + takeover = 'never', -- can't open it with never at all? + }, + }, + } + end, + }, + { + -- enables UNIX specific stuff in vim, + -- specifically: + -- :SudoWrite + -- :SudoRead + -- :Chmod + -- and also some more, but those are easy done with shell + 'tpope/vim-eunuch', + lazy = false, + }, + { + 'mikesmithgh/kitty-scrollback.nvim', + enabled = true, + lazy = true, + cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth' }, + event = { 'User KittyScrollbackLaunch' }, + -- version = '*', -- latest stable version, may have breaking changes if major version changed + -- version = '^3.0.0', -- pin major version, include fixes and features that do not have breaking changes + config = function() + require('kitty-scrollback').setup { + myconfig = function() + return { keymaps_enabled = false } + end, + } + end, + }, - { import = 'custom.plugins' }, + { import = 'custom.plugins' }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index ffe177c..7985fd7 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -1,359 +1,350 @@ return { - { - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', + { + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + -- Useful status updates for LSP. + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { 'folke/lazydev.nvim' }, - }, - config = function() - require 'custom.plugins.configs.lsp' - end, - }, - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - { - 'folke/trouble.nvim', - cmd = 'Trouble', - opts = { use_diagnostic_signs = true }, - keys = { - { 'ctb', 'Trouble diagnostics toggle filter.buf=0', desc = 'Document Diagnostics (Trouble)' }, - { 'ctr', 'Trouble diagnostics toggle', desc = 'Workspace Diagnostics (Trouble)' }, - { 'ctq', 'Trouble qflist toggle', desc = 'Quickfix List (Trouble)' }, - { 'ctl', 'Trouble loclist toggle', desc = 'Location List (Trouble)' }, - { 'ctd', 'Trouble symbols', desc = 'LSP symbols (Trouble)' }, - { 'ctt', 'Trouble todo', desc = 'Todos (Trouble)' }, - { 'cts', 'Trouble lsp_document_symbols toggle win.position=right', desc = 'Document [S]ymbols side (Trouble)' }, - { - '[q', - function() - if require('trouble').is_open() then - require('trouble').previous { skip_groups = true, jump = true } - else - vim.cmd.cprev() - end - end, - desc = 'Previous trouble/quickfix item', - }, - { - ']q', - function() - if require('trouble').is_open() then - require('trouble').next { skip_groups = true, jump = true } - else - vim.cmd.cnext() - end - end, - desc = 'Next trouble/quickfix item', - }, - }, - }, - { -- Autocompletion - 'hrsh7th/nvim-cmp', - enabled = not vim.g.started_by_firenvim, - event = 'InsertEnter', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - }, - }, - 'saadparwaiz1/cmp_luasnip', + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + { 'folke/lazydev.nvim' }, + }, + config = function() + require 'custom.plugins.configs.lsp' + end, + }, + -- See `:help gitsigns` to understand what the configuration keys do + { -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + { + 'folke/trouble.nvim', + cmd = 'Trouble', + opts = { use_diagnostic_signs = true }, + keys = { + { 'ctb', 'Trouble diagnostics toggle filter.buf=0', desc = 'Document Diagnostics (Trouble)' }, + { 'ctr', 'Trouble diagnostics toggle', desc = 'Workspace Diagnostics (Trouble)' }, + { 'ctq', 'Trouble qflist toggle', desc = 'Quickfix List (Trouble)' }, + { 'ctl', 'Trouble loclist toggle', desc = 'Location List (Trouble)' }, + { 'ctd', 'Trouble symbols', desc = 'LSP symbols (Trouble)' }, + { 'ctt', 'Trouble todo', desc = 'Todos (Trouble)' }, + { 'cts', 'Trouble lsp_document_symbols toggle win.position=right', desc = 'Document [S]ymbols side (Trouble)' }, + { + '[q', + function() + if require('trouble').is_open() then + require('trouble').previous { skip_groups = true, jump = true } + else + vim.cmd.cprev() + end + end, + desc = 'Previous trouble/quickfix item', + }, + { + ']q', + function() + if require('trouble').is_open() then + require('trouble').next { skip_groups = true, jump = true } + else + vim.cmd.cnext() + end + end, + desc = 'Next trouble/quickfix item', + }, + }, + }, + { -- Autocompletion + 'hrsh7th/nvim-cmp', + enabled = not vim.g.started_by_firenvim, + event = 'InsertEnter', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, + }, + }, + 'saadparwaiz1/cmp_luasnip', - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + }, + config = function() + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - -- [''] = cmp.mapping.confirm { select = true }, + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- [''] = cmp.mapping.confirm { select = true }, - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - [''] = cmp.mapping.confirm { select = true }, - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - --[''] = cmp.mapping(function() - -- if luasnip.expand_or_locally_jumpable() then - -- luasnip.expand_or_jump() - -- end - --end, { 'i', 's' }), - --[''] = cmp.mapping(function() - -- if luasnip.locally_jumpable(-1) then - -- luasnip.jump(-1) - -- end - --end, { 'i', 's' }), + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + --[''] = cmp.mapping(function() + -- if luasnip.expand_or_locally_jumpable() then + -- luasnip.expand_or_jump() + -- end + --end, { 'i', 's' }), + --[''] = cmp.mapping(function() + -- if luasnip.locally_jumpable(-1) then + -- luasnip.jump(-1) + -- end + --end, { 'i', 's' }), - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - config = function(_, opts) - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, + }, + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + config = function(_, opts) + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - -- Prefer git instead of curl in order to improve connectivity in some environments - require('nvim-treesitter.install').prefer_git = true - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup(opts) + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup(opts) - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - end, - }, - { - 'kevinhwang91/nvim-bqf', - ft = 'qf', - cmd = 'BqfAutoToggle', - event = 'QuickFixCmdPost', - opts = { - auto_resize_height = false, - func_map = { - tab = 'st', - split = 'sv', - vsplit = 'sg', + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + end, + }, + { + 'kevinhwang91/nvim-bqf', + ft = 'qf', + cmd = 'BqfAutoToggle', + event = 'QuickFixCmdPost', + opts = { + auto_resize_height = false, + func_map = { + tab = 'st', + split = 'sv', + vsplit = 'sg', - stoggleup = 'K', - stoggledown = 'J', - stogglevm = '', + stoggleup = 'K', + stoggledown = 'J', + stogglevm = '', - ptoggleitem = 'p', - ptoggleauto = 'P', - ptogglemode = 'zp', + ptoggleitem = 'p', + ptoggleauto = 'P', + ptogglemode = 'zp', - pscrollup = '', - pscrolldown = '', + pscrollup = '', + pscrolldown = '', - prevfile = 'gk', - nextfile = 'gj', + prevfile = 'gk', + nextfile = 'gj', - prevhist = '', - nexthist = '', - }, - preview = { - auto_preview = true, - should_preview_cb = function(bufnr) - -- file size greater than 100kb can't be previewed automatically - local filename = vim.api.nvim_buf_get_name(bufnr) - local fsize = vim.fn.getfsize(filename) - if fsize > 100 * 1024 then - return false - end - return true - end, - }, - }, - }, - { - 'rmagatti/goto-preview', - event = 'FileType', - keys = { - { - 'gpd', - function() - require('goto-preview').goto_preview_definition() - end, - desc = 'Go to definition preview', - }, - { - 'gpD', - function() - require('goto-preview').goto_preview_declaration() - end, - desc = 'Go to declaration preview', - }, - { - 'gpi', - function() - require('goto-preview').goto_preview_implementation() - end, - desc = 'Go to implementaion preview', - }, - { - 'gpt', - function() - require('goto-preview').goto_preview_type_definition() - end, - desc = 'Go to type preview', - }, - { - 'gpt', - function() - require('goto-preview').goto_preview_type_references() - end, - desc = 'Preview references', - }, - { - 'gpc', - function() - require('goto-preview').close_all_win() - end, - desc = 'Close all preview windows', - }, - }, - config = function() - require('goto-preview').setup {} - end, - dependencies = 'nvim-telescope/telescope.nvim', - opts = { - width = 78, - height = 15, - default_mappings = false, - opacity = 10, - }, - }, - { 'kosayoda/nvim-lightbulb', event = { 'BufReadPre', 'BufNewFile' } }, - { - 'folke/lazydev.nvim', - ft = 'lua', -- only load on lua files - opts = { - library = { - -- See the configuration section for more details - -- Load luvit types when the `vim.uv` word is found - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings - { - 'nvimtools/none-ls.nvim', - config = function() - local null_ls = require 'null-ls' + prevhist = '', + nexthist = '', + }, + preview = { + auto_preview = true, + should_preview_cb = function(bufnr) + -- file size greater than 100kb can't be previewed automatically + local filename = vim.api.nvim_buf_get_name(bufnr) + local fsize = vim.fn.getfsize(filename) + if fsize > 100 * 1024 then + return false + end + return true + end, + }, + }, + }, + { + 'rmagatti/goto-preview', + event = 'FileType', + keys = { + { + 'gpd', + function() + require('goto-preview').goto_preview_definition() + end, + desc = 'Go to definition preview', + }, + { + 'gpD', + function() + require('goto-preview').goto_preview_declaration() + end, + desc = 'Go to declaration preview', + }, + { + 'gpi', + function() + require('goto-preview').goto_preview_implementation() + end, + desc = 'Go to implementaion preview', + }, + { + 'gpt', + function() + require('goto-preview').goto_preview_type_definition() + end, + desc = 'Go to type preview', + }, + { + 'gpt', + function() + require('goto-preview').goto_preview_type_references() + end, + desc = 'Preview references', + }, + { + 'gpc', + function() + require('goto-preview').close_all_win() + end, + desc = 'Close all preview windows', + }, + }, + config = function() + require('goto-preview').setup {} + end, + dependencies = 'nvim-telescope/telescope.nvim', + opts = { + width = 78, + height = 15, + default_mappings = false, + opacity = 10, + }, + }, + { 'kosayoda/nvim-lightbulb', event = { 'BufReadPre', 'BufNewFile' } }, + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings + { + 'nvimtools/none-ls.nvim', + config = function() + local null_ls = require 'null-ls' - null_ls.setup { - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.gdformat, - null_ls.builtins.diagnostics.gdlint, - }, - } - end, - }, - { - 'chomosuke/typst-preview.nvim', - ft = 'typst', - version = '1.*', - opts = { - dependencies_bin = { ['tinymist'] = 'tinymist' }, -- use mason - }, -- lazy.nvim will implicitly calls `setup {}` - }, - { - 'hedyhli/outline.nvim', - lazy = true, - cmd = { 'Outline', 'OutlineOpen' }, - keys = { -- Example mapping to toggle outline - { 'to', 'Outline', desc = 'Toggle outline' }, - }, - opts = {}, - }, + null_ls.setup { + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.gdformat, + null_ls.builtins.diagnostics.gdlint, + }, + } + end, + }, + { + 'chomosuke/typst-preview.nvim', + ft = 'typst', + version = '1.*', + opts = { + dependencies_bin = { ['tinymist'] = 'tinymist' }, -- use mason + }, -- lazy.nvim will implicitly calls `setup {}` + }, } diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index 63021ae..d9574bc 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -631,3 +631,15 @@ Mitgliedern Immunitätsrecht GN Normebene +ALgorithmus +implementation/! +Implementation +datentypen/! +Datentypen +Toolchain +Ceedling +tests/! +Tests +Unit +Unity +Build