diff --git a/init.lua b/init.lua index 44842ec..e8f7cbc 100644 --- a/init.lua +++ b/init.lua @@ -16,6 +16,8 @@ o.guifont = 'IosevkaTermSlab Nerd Font,IosevkaTerm Nerd Font,Iosevka Term Slab,I g.neovide_floating_z_height = 1 g.neovide_confirm_quit = true -- Confirm closing neovide window when changes are unsaved g.neovide_cursor_smooth_blink = true +g.neovide_text_gamma = 0.8 +g.neovide_text_contrast = 0.1 if fn.hostname() == 'tappy' then g.neovide_refresh_rate = 144 end @@ -134,6 +136,10 @@ local function zoom_out() zoom(-1) end +if not workman then + vim.keymap.set('n', 'j', 'gj') + vim.keymap.set('n', 'k', 'gk') +end vim.keymap.set('n', '!', 'copen', { desc = 'Quickfix window' }) vim.keymap.set('n', '', 'set number! relativenumber!', { desc = 'Toggle relative numbers' }) vim.keymap.set('n', '', 'set number!', { desc = 'Toggle line numbers' }) @@ -189,8 +195,8 @@ vim.keymap.set('n', 'es', vim.diagnostic.show, { desc = 'Show diagnostic vim.keymap.set('n', 'eC', vim.diagnostic.reset, { desc = 'Clear diagnostics' }) if vim.g.neovide then - vim.keymap.set('l', '', '+', { desc = 'Paste' }) - vim.keymap.set('l', '', '+', { desc = 'Paste' }) + vim.keymap.set({'i', 'c'}, '', '+', { desc = 'Paste' }) + vim.keymap.set({'i', 'c'}, '', '+', { desc = 'Paste' }) vim.keymap.set('t', '', 'pi', { desc = 'Paste' }) end @@ -304,21 +310,21 @@ require('lazy').setup({ 'rhysd/vim-crystal', 'bakpakin/fennel.vim', 'mboughaba/i3config.vim', - {'OXY2DEV/markview.nvim', lazy = false, opts = { initial_state = false }}, + {'OXY2DEV/markview.nvim', lazy = false, opts = { preview = { enable = false } }}, 'mracos/mermaid.vim', 'lifepillar/pgsql.vim', + 'digitaltoad/vim-pug', 'ajouellette/sway-vim-syntax', - 'cespare/vim-toml', 'mfussenegger/nvim-ansible', -- Editing - {'LunarWatcher/auto-pairs', init = function() - vim.g.AutoPairsMultilineClose = 0 - vim.g.AutoPairsMapBS = 1 - vim.g.AutoPairsMapCR = 1 - vim.g.AutoPairsCompatibleMaps = 1 - vim.g.AutoPairsShortcutToggleMultilineClose = '' - end}, + {'altermo/ultimate-autopair.nvim', branch = 'v0.6', opts = { + -- Settings for moving delimiter after cursor/Alt-E mapping + fastwarp = { + -- Don't make the cursor stay in place + nocursormove = false, + } + }}, 'ojroques/nvim-bufdel', {'stevearc/conform.nvim', config = function () require'conform'.setup { @@ -390,10 +396,10 @@ require('lazy').setup({ 'hrsh7th/vim-vsnip', -- LSP -- - {'neovim/nvim-lspconfig', dependencies = {'hrsh7th/cmp-nvim-lsp', 'williamboman/mason-lspconfig.nvim'}, config = function() + {'neovim/nvim-lspconfig', dependencies = {'saghen/blink.cmp', 'williamboman/mason-lspconfig.nvim'}, config = function() local lspconfig = require'lspconfig' - -- Tweak the advertized LSP client capabilities - local capabilities = require'cmp_nvim_lsp'.default_capabilities() + -- Extend the LSP client capabilities advertized to servers + local capabilities = require'blink.cmp'.get_lsp_capabilities() -- Set options for nvim-ufo capabilities.textDocument.foldingRange = { dynamicRegistration = false, @@ -406,7 +412,17 @@ require('lazy').setup({ lspconfig.ansiblels.setup {} lspconfig.bashls.setup {} lspconfig.clangd.setup {} - lspconfig.eslint.setup { autostart = false } + lspconfig.cssls.setup {} + lspconfig.eslint.setup { + settings = { + rulesCustomizations = { + { rule = '*no-shadow*', severity = 'off' }, + { rule = '*no-unused-vars', severity = 'off' } + }, + }, + } + lspconfig.html.setup {} + lspconfig.jsonls.setup {} lspconfig.lemminx.setup {} lspconfig.lua_ls.setup { settings = { @@ -428,119 +444,90 @@ require('lazy').setup({ } } lspconfig.nil_ls.setup {} - lspconfig.basedpyright.setup {} + --lspconfig.basedpyright.setup {} + lspconfig.pyright.setup {} lspconfig.vimls.setup {} + lspconfig.yamlls.setup {} + end}, + {'Saghen/blink.cmp', dependencies = {'altermo/ultimate-autopair.nvim', 'rcarriga/cmp-dap'}, lazy = false, build = 'cargo build --release', opts_extend = {'sources.default'}, opts = { + keymap = { + -- Tab to select completion, enter to accept + preset = 'enter', + [''] = {'select_next', 'snippet_forward', 'fallback'}, + [''] = {'select_prev', 'snippet_backward', 'fallback'}, + [''] = {'show_signature', 'hide_signature', 'fallback'}, + }, - -- TODO decide what to do with autocmd - end}, - {'hrsh7th/nvim-cmp', dependencies = { - 'rcarriga/cmp-dap', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'dcampos/nvim-snippy', - 'dcampos/cmp-snippy', - 'LunarWatcher/auto-pairs' - }, config = function() - local cmp = require'cmp' - local cmp_dap = require'cmp_dap' - local snippy = require'snippy' - vim.opt.completeopt:append({'menuone', 'noinsert', 'noselect'}) - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - cmp.setup { - enabled = function() - return vim.bo.buftype ~= 'prompt' or cmp_dap.is_dap_buffer() - end, - preselect = cmp.PreselectMode.None, - snippet = { - expand = function(args) - require('snippy').expand_snippet(args.body) - end, + enabled = function() + return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" + or require("cmp_dap").is_dap_buffer() + end, + appearance = { + -- Use nvim-cmp highlight groups as fallback for plugins without direct support for blink.cmp + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'normal', + }, + + cmdline = { + completion = { + list = { + selection = { preselect = false, auto_insert = true } + }, + menu = { + auto_show = true + }, }, - mapping = cmp.mapping.preset.insert { - -- Next item, or expand or jump snippet, or fallback - [''] = cmp.mapping( - function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif snippy.can_expand_or_advance() then - snippy.expand_or_advance() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, - {'i', 's'} - ), - -- Prev item, or jump snippet back, or fallback - [''] = cmp.mapping( - function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif snippy.can_jump(-1) then - snippy.previous() - else - fallback() - end - end, - {'i', 's'} - ), - -- Scroll documentation up - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), - -- Scroll documentation down - [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), - -- Complete common substring - [''] = cmp.mapping(cmp.mapping.complete_common_string(), {'i', 'c'}), - -- Complete - [''] = cmp.mapping(cmp.mapping.complete {}, {'i', 'c'}), - -- Confirm - [''] = cmp.mapping(cmp.mapping.confirm { select = false }, {'i', 'c'}), + }, + completion = { + list = { + -- Don't automatically select the first completion item + selection = { preselect = false, auto_insert = true } }, - sources = { - { name = 'path' }, - { name = 'nvim_lsp' }, - { name = 'nvim_lua' }, - { name = 'snippy' }, + + accept = { + -- Disable experimental automatic bracket insertion + auto_brackets = { enabled = false } }, - -- Experimental features - experimental = { - -- Show completion result as virtual text - ghost_text = true, + + documentation = { + -- Show documentation in the completion menu automatically + auto_show = true, }, - } - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } + + -- Show virtual text of completion result after cursor + ghost_text = { enabled = true }, + }, + + -- Experimental function signature help + signature = { + enabled = true, + window = { + -- Prefer showing signature help below cursor + direction_priority = {'s', 'n'}, + -- Don't show documentation by default + show_documentation = false, }, - { - { - name = 'cmdline', - option = { - ignore_cmds = { 'Man', '!' } - } - } - }), - }) - cmp.setup.cmdline({'/', '?'}, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } + }, + + -- Default list of sources + sources = { + default = {'lsp', 'path', 'snippets'}, + per_filetype = { + ['dap-repl'] = {'dap'}, + dapui_watches = {'dap'}, + dapui_hover = {'dap'}, }, - }) - cmp.setup.filetype({'dap-repl', 'dapui_watches', 'dapui_hover'}, { - sources = { - { name = 'dap' }, + providers = { + dap = { + name = 'dap', + module = 'blink.compat.source', + }, }, - }) - end}, + }, + }}, + {'Saghen/blink.compat', lazy = true, opts = {}}, {'mfussenegger/nvim-jdtls', dependencies = {'neovim/nvim-lspconfig'}, config = function() au('FileType', { pattern = 'java', @@ -562,6 +549,8 @@ require('lazy').setup({ '--jvm-arg=-Dlog.protocol=true', -- Enable lombok '--jvm-arg=-javaagent:' .. mason_path('jdtls') .. '/lombok.jar', + -- Shut the warning up + '--jvm-arg=-XX:+EnableDynamicAgentLoading', -- store workpace data in ~/.local/share/eclipse/ '-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t') }, @@ -650,8 +639,14 @@ require('lazy').setup({ }}, {'pmizio/typescript-tools.nvim', opts = { settings = { - tsserve_file_preferences = { - quotePreference = 'single' + tsserver_file_preferences = { + quotePreference = 'single', + semicolons = 'remove', + convertTabsToSpaces = false, + }, + tsserver_format_options = { + semicolons = 'remove', + convertTabsToSpaces = false, }, tsserver_plugins = (function () if fn.has('nvim-0.10') == 0 then return end @@ -771,14 +766,6 @@ require('lazy').setup({ vim.g.db_ui_auto_execute_table_helpers = 1 vim.g.db_ui_win_position = 'right' vim.o.previewheight = 40 - vim.api.nvim_create_autocmd('FileType', { - group = 'luarc', - pattern = {'sql','mysql','plsql'}, - callback = function() - require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} }) - end, - desc = 'SQL dadbod completion', - }) end}, {'mfussenegger/nvim-dap', dependencies = {'folke/which-key.nvim'}, config = function() local dap = require'dap' @@ -917,12 +904,6 @@ require('lazy').setup({ dap.listeners.after.event_initialized.dapui_config = function() dapui.open {} end - dap.listeners.before.event_terminated.dapui_config = function() - dapui.close {} - end - dap.listeners.before.event_exited.dapui_config = function() - dapui.close {} - end require'which-key'.register { ['dd'] = {dapui.toggle, 'Toggle'} } @@ -949,7 +930,10 @@ require('lazy').setup({ }, file_panel = { ["gq"] = "DiffviewClose", - } + }, + file_history_panel = { + ["gq"] = "DiffviewClose", + }, } }}, {'stevearc/dressing.nvim', opts = { @@ -993,7 +977,7 @@ require('lazy').setup({ }, build = function() require'gitlab.server'.build(true) end, opts = { - attachment_dir = vim.fn.expand('~/Downloads/'), + attachment_dir = vim.fn.expand('~/Desktop/'), keymaps = { global = { disable_all = true, @@ -1108,7 +1092,17 @@ require('lazy').setup({ vim.notify = require'notify' require'telescope'.load_extension('notify') end}, - {'stevearc/overseer.nvim', dependencies = {'folke/which-key.nvim'}, config = function(plugin, opts) + {'stevearc/overseer.nvim', dependencies = {'folke/which-key.nvim'}, opts = { + task_list = { + bindings = { + ['x'] = 'Stop', + ['dd'] = 'Dispose', + ['r'] = 'OverseerQuickAction restart', + [''] = false, + [''] = false, + }, + }, + }, config = function(plugin, opts) require'overseer'.setup(opts) require'which-key'.register { ['r'] = { @@ -1147,7 +1141,7 @@ require('lazy').setup({ } end}, {'nvim-telescope/telescope.nvim', dependencies = { - 'LunarWatcher/auto-pairs', + 'altermo/ultimate-autopair.nvim', 'nvim-telescope/telescope-fzf-native.nvim', 'nvim-telescope/telescope-file-browser.nvim', 'nvim-telescope/telescope-project.nvim',