From dbbbb97b715f022251e2d1826967222b5865a949 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 8 Jul 2024 13:55:22 +0300 Subject: Neovim: refactored keymaps to , completions now have good keybindings and did some slight tweaks --- .config/nvim/lua/autocmds.lua | 18 -------- .config/nvim/lua/custom/completion.lua | 2 - .config/nvim/lua/custom/lsp.lua | 2 - .../nvim/lua/custom/plugins/TODO-completion.lua | 19 --------- .config/nvim/lua/custom/plugins/completion.lua | 16 +++++++ .config/nvim/lua/keymaps.lua | 46 -------------------- .config/nvim/lua/options.lua | 49 ---------------------- .config/nvim/lua/plugin-manager.lua | 15 ------- 8 files changed, 16 insertions(+), 151 deletions(-) delete mode 100644 .config/nvim/lua/autocmds.lua delete mode 100644 .config/nvim/lua/custom/plugins/TODO-completion.lua create mode 100644 .config/nvim/lua/custom/plugins/completion.lua delete mode 100644 .config/nvim/lua/keymaps.lua delete mode 100644 .config/nvim/lua/options.lua delete mode 100644 .config/nvim/lua/plugin-manager.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/autocmds.lua b/.config/nvim/lua/autocmds.lua deleted file mode 100644 index 5272029..0000000 --- a/.config/nvim/lua/autocmds.lua +++ /dev/null @@ -1,18 +0,0 @@ -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking text', - group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) - --- vim.api.nvim_create_autocmd('FileType', { --- group = vim.api.nvim_create_augroup('disable-auto-comment', { clear = true }), --- pattern = '*', --- callback = function() --- -- c - autowrap using textwidth | r - enter in insert mode | o - o/O in normal mode --- -- vim.opt.formatoptions:remove({ 'c', 'r', 'o' }) --- vim.opt.formatoptions:remove('o') --- -- vim.cmd('set formatoptions-=o') --- end, --- }) diff --git a/.config/nvim/lua/custom/completion.lua b/.config/nvim/lua/custom/completion.lua index 80c9531..04ae172 100644 --- a/.config/nvim/lua/custom/completion.lua +++ b/.config/nvim/lua/custom/completion.lua @@ -67,5 +67,3 @@ cmp.setup({ [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), }), }) - -print('Sourced completion.lua') diff --git a/.config/nvim/lua/custom/lsp.lua b/.config/nvim/lua/custom/lsp.lua index d534e22..929014d 100644 --- a/.config/nvim/lua/custom/lsp.lua +++ b/.config/nvim/lua/custom/lsp.lua @@ -97,5 +97,3 @@ vim.api.nvim_create_autocmd('LspAttach', { -- -- require('lsp_lines').setup() -- vim.diagnostic.config({ virtual_text = false }) - -print('Sourced lsp.lua') diff --git a/.config/nvim/lua/custom/plugins/TODO-completion.lua b/.config/nvim/lua/custom/plugins/TODO-completion.lua deleted file mode 100644 index 3f0ba3e..0000000 --- a/.config/nvim/lua/custom/plugins/TODO-completion.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - { - 'hrsh7th/nvim-cmp', - lazy = false, - priority = 100, - dependencies = { - -- 'onsails/lspkind.nvim', - -- 'hrsh7th/cmp-path', - -- 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp - 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp - { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin - }, - -- TODO: Move to setup opts - config = function() - require('custom.completion') - end, - }, -} diff --git a/.config/nvim/lua/custom/plugins/completion.lua b/.config/nvim/lua/custom/plugins/completion.lua new file mode 100644 index 0000000..5e0f2ef --- /dev/null +++ b/.config/nvim/lua/custom/plugins/completion.lua @@ -0,0 +1,16 @@ +return { + 'hrsh7th/nvim-cmp', + lazy = false, + priority = 100, + dependencies = { + -- 'onsails/lspkind.nvim', + -- 'hrsh7th/cmp-path', + -- 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp + 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp + { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin + }, + config = function() + require('custom.completion') + end, +} diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua deleted file mode 100644 index a48679e..0000000 --- a/.config/nvim/lua/keymaps.lua +++ /dev/null @@ -1,46 +0,0 @@ -local set = vim.keymap.set -local silent = { silent = true } ----@param mode string|table ----@param keymap string -local function unbind(mode, keymap) - set(mode, keymap, function() end) -end - --- Misc -set({ 'n', 'i' }, '', 'ggVG', { desc = 'Visually Highlight [A]ll' }) -set('n', '', 'nohlsearch', silent) -set({ 'i', 'c' }, '', function() - vim.fn.getreg('+') -end) -set('n', 'z', function() - vim.cmd('Neotree close') - vim.cmd('Trouble todo close') - vim.cmd('UndotreeHide') -end, { desc = '[Z]en Mode', silent = true }) -unbind({ 'i', 'n', 'v' }, '') - -set('n', 'U', 'redo') -set('i', '', 'undo') - --- Window Navigation -set('n', '', '', { desc = 'Move focus to the left window' }) -set('n', '', '', { desc = 'Move focus to the down window' }) -set('n', '', '', { desc = 'Move focus to the up window' }) -set('n', '', '', { desc = 'Move focus to the right window' }) - --- Window resizing -local resize = 2 -set({ 'n', 't' }, '', string.format('vertical resize -%d', resize), { desc = 'Resize Left' }) -set({ 'n', 't' }, '', string.format('resize -%d', resize), { desc = 'Resize Up' }) -set({ 'n', 't' }, '', string.format('resize +%d', resize), { desc = 'Resize Down' }) -set({ 'n', 't' }, '', string.format('vertical resize +%d', resize), { desc = 'Resize Right' }) - --- Keep selection after < and > in visual mode -set('v', '<', '', '>gv') - --- Execute lua file or line -set('n', 'x', '.lua', { desc = 'Execute the current line' }) -set('n', 'x', 'source %', { desc = 'Execute the current file' }) - -print('Sourced keymaps.lua') diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua deleted file mode 100644 index 0ff65b9..0000000 --- a/.config/nvim/lua/options.lua +++ /dev/null @@ -1,49 +0,0 @@ -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - --- System -vim.g.have_nerd_font = true -vim.opt.mouse = 'a' -- enable mouse -vim.opt.clipboard = 'unnamedplus' -- use system clipboard -vim.opt.undofile = true -- Persist undo history by saving it to a file - --- Tab -vim.opt.expandtab = true -- convert tabs to spaces -vim.opt.tabstop = 4 -- number of visual spaces per TAB -vim.opt.softtabstop = 4 -- number of idfk tab when editing -vim.opt.shiftwidth = 4 -- number of spaces to insert on tab - --- UI -vim.opt.signcolumn = 'auto:9' -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.cursorline = true -- highlight current line -vim.opt.splitright = true -vim.opt.splitbelow = true -vim.opt.showmode = false -- don't show mode, because lualine already does -vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -vim.diagnostic.config({ signs = false }) -- disable signcolumn diagnostics - --- Searching -vim.opt.hlsearch = true -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Misc -vim.opt.wrap = false -vim.opt.scrolloff = 8 -vim.opt.undofile = true -vim.opt.termguicolors = true -vim.opt.laststatus = 3 -- views can only be fully collapsed with the global statusline -vim.opt.splitkeep = 'screen' -- for edgy.nvim -vim.opt.inccommand = 'split' -- shows preview for commands like :%s/from/to -vim.opt.formatoptions:remove('o') -- don't have `o` add a comment - --- Disable warnings for missing language providers -vim.g.loaded_node_provider = 0 -vim.g.loaded_perl_provider = 0 -vim.g.loaded_ruby_provider = 0 -vim.g.loaded_python3_provider = 0 - -print('Sourced options.lua') diff --git a/.config/nvim/lua/plugin-manager.lua b/.config/nvim/lua/plugin-manager.lua deleted file mode 100644 index 970847e..0000000 --- a/.config/nvim/lua/plugin-manager.lua +++ /dev/null @@ -1,15 +0,0 @@ -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) -require('lazy').setup({ import = 'custom/plugins' }, { - change_detection = { notify = false }, -}) -- cgit v1.3.1