From ec950f9d196b54bbe382a035f01d12fcd172a9b8 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 17 Aug 2022 15:53:34 +0300 Subject: nvim: bring in leap.nvim, vim.keymap.set --- .config/nvim/lua/plugin_settings.lua | 96 ++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 25 deletions(-) (limited to '.config/nvim/lua/plugin_settings.lua') diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index 41a663a..734efd3 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua @@ -38,11 +38,6 @@ local function lualine_spell() end end --- Grinds vim to a halt -local function lualine_tex_wordcount() - return vim.fn['vimtex#misc#wordcount']() .. " ‽" -end - local conditions = { spell_on = function () return vim.wo.spell @@ -337,38 +332,38 @@ local nvim_lsp = require('lspconfig') -- Mappings. local opts = { noremap=true, silent=true } -vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) -vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) -vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) -vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) local on_attach = function(client, bufnr) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- See `:help vim.lsp.*` for documentation on any of the below functions - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'vh', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', 'lua vim.lsp.buf.implementation()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fm', 'lua vim.lsp.buf.formatting()', opts) + local bufopts = { noremap=true, silent=true, buffer=bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'vh', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gh', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'fm', vim.lsp.buf.formatting, bufopts) end local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd', 'ltex' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, - flags = { - debounce_text_changes = 150, - }, capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) } end @@ -555,3 +550,54 @@ require('rose-pine').setup({ -- set colorscheme after options vim.cmd('colorscheme rose-pine') -- }}} Rose Pine -- + +-- dial.nvim {{{ -- + +local augend = require("dial.augend") +require("dial.config").augends:register_group{ + -- default augends used when no group name is specified + default = { + augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) + augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) + augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) + augend.date.alias["%Y-%m-%d"], + augend.semver.alias.semver, + augend.constant.new{ + elements = {"and", "or"}, + word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. + cyclic = true, -- "or" is incremented into "and". + }, + augend.constant.new{ + elements = {"&&", "||"}, + word = false, + cyclic = true, + }, + }, +} + +-- }}} dial.nvim -- + +-- leap.nvim {{{ -- +require('leap').setup { + max_aot_targets = nil, + highlight_unlabeled = false, + case_sensitive = false, + -- Groups of characters that should match each other. + -- Obvious candidates are braces & quotes ('([{', ')]}', '`"\''). + character_classes = { ' \t\r\n', }, + -- Leaving the appropriate list empty effectively disables "smart" mode, + -- and forces auto-jump to be on or off. + -- safe_labels = { . . . }, + -- labels = { . . . }, + -- These keys are captured directly by the plugin at runtime. + -- (For `prev_match`, I suggest if possible in the terminal/GUI.) + special_keys = { + repeat_search = '', + next_match = '', + prev_match = '', + next_group = '', + prev_group = '', + }, +} + +-- }}} leap.nvim -- -- cgit v1.2.3-70-g09d2