diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua index a7845e6..ab1eee6 100644 --- a/.config/nvim/lua/keybindings.lua +++ b/.config/nvim/lua/keybindings.lua @@ -1,10 +1,8 @@ -local map = vim.api.nvim_set_keymap +local set = vim.keymap.set local opts = { - noremap = true, silent = true, } local e_opts = { - noremap = true, silent = true, expr = true, } @@ -16,46 +14,51 @@ end -- -map("", "", "", opts) +set("", "", "", opts) vim.g.mapleader = " " vim.g.maplocalleader = " " -- For navigation with soft wrap -map("n", "j", "v:count == 0 ? 'gj' : 'j'", e_opts) -map("n", "k", "v:count == 0 ? 'gk' : 'k'", e_opts) +set("n", "j", "v:count == 0 ? 'gj' : 'j'", e_opts) +set("n", "k", "v:count == 0 ? 'gk' : 'k'", e_opts) -- -map("n", "", cmd("BufferLineCycleNext"), opts) -map("n", "", cmd("BufferLineCyclePrev"), opts) +set("n", "", cmd("BufferLineCycleNext"), opts) +set("n", "", cmd("BufferLineCyclePrev"), opts) -map("n", "", cmd("Neotree"), opts) +set("n", "", cmd("Neotree"), opts) -- Telescope -map("n", "", cmd("lua require('plugins.telescope').custom_find_files()"), opts) -map("n", "", cmd("lua require('plugins.telescope').custom_find_hidden_files()"), opts) -map("n", "", cmd("lua require('telescope.builtin').current_buffer_fuzzy_find()"), opts) +local custom_telescope = require("plugins.telescope") +local builtin_telescope = require("telescope.builtin") +set("n", "", custom_telescope.custom_find_files, opts) +set("n", "", custom_telescope.custom_find_hidden_files, opts) +set("n", "", builtin_telescope.current_buffer_fuzzy_find, opts) -- -map("n", "f", cmd("lua require('telescope.builtin').live_grep()"), opts) -map("n", "s", cmd("lua require('telescope.builtin').lsp_document_symbols()"), opts) -map("n", "d", cmd("lua require('telescope.builtin').lsp_definitions()"), opts) -map("n", "r", cmd("lua require('telescope.builtin').lsp_references()"), opts) +set("n", "f", builtin_telescope.live_grep, opts) +set("n", "s", builtin_telescope.lsp_document_symbols, opts) +set("n", "d", builtin_telescope.lsp_definitions, opts) +set("n", "r", builtin_telescope.lsp_references, opts) -- LSP -map("n", "h", cmd("lua vim.lsp.buf.hover()"), opts) +set("n", "h", vim.lsp.buf.hover, opts) -- Focus -vim.api.nvim_set_keymap("n", "", cmd("lua require('focus').split_cycle()"), opts) +local focus = require("focus") +set("n", "L", focus.split_cycle, opts) -- hlslens -map("n", "n", [[execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()]], opts) -map("n", "N", [[execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()]], opts) -map("n", "*", [[*lua require('hlslens').start()]], opts) -map("n", "#", [[#lua require('hlslens').start()]], opts) -map("n", "g*", [[g*lua require('hlslens').start()]], opts) -map("n", "g#", [[g#lua require('hlslens').start()]], opts) +local map = vim.api.nvim_set_keymap +local map_opts = { + noremap = true, + silent = true, +} -- -map("x", "*", [[*lua require('hlslens').start()]], opts) -map("x", "#", [[#lua require('hlslens').start()]], opts) -map("x", "g*", [[g*lua require('hlslens').start()]], opts) -map("x", "g#", [[g#lua require('hlslens').start()]], opts) +map("n", "n", [[execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()]], map_opts) +map("n", "N", [[execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()]], map_opts) +map("n", "*", [[*lua require('hlslens').start()]], map_opts) +map("n", "#", [[#lua require('hlslens').start()]], map_opts) +-- +map("x", "*", [[*lua require('hlslens').start()]], map_opts) +map("x", "#", [[#lua require('hlslens').start()]], map_opts) diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua index a170bf6..8aa9392 100644 --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -39,8 +39,17 @@ opt.confirm = true opt.linebreak = true +opt.laststatus = 3 + -- Highlight on yank -vim.cmd([[au TextYankPost * silent! lua vim.highlight.on_yank {timeout=1200}]]) +local function custom_highlight_on_yank() + return vim.highlight.on_yank({ timeout = 1200 }) +end + +vim.api.nvim_create_autocmd("TextYankPost", { + pattern = "*", + callback = custom_highlight_on_yank, +}) -- Disable diagnostics vim.diagnostic.disable() diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 107bf06..d0629d1 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -26,7 +26,6 @@ return require("packer").startup(function() requires = { "nvim-lua/plenary.nvim", }, - tag = "nvim-0.6", }) -- use({ @@ -66,7 +65,6 @@ return require("packer").startup(function() -- Comment use({ "numToStr/Comment.nvim", - tag = "v0.6", }) -- Todo-comment