diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-05-02 18:37:01 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-05-02 18:37:01 +0300 |
| commit | 85f647fea444994eca583fad9047fa3b35347cdf (patch) | |
| tree | 1a1d2b99e5cafd2af9ed89a866f710031982045d /.config | |
| parent | 8328f842e77850d30b7e6ece485ed2c163d9ffe0 (diff) | |
Changed some keymaps/options from lazyvim
Diffstat (limited to '.config')
| -rw-r--r-- | .config/nvim/after/ftplugin/go.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 5 | ||||
| -rw-r--r-- | .config/nvim/lua/keymaps.lua | 43 | ||||
| -rw-r--r-- | .config/nvim/lua/options.lua | 17 |
4 files changed, 33 insertions, 34 deletions
diff --git a/.config/nvim/after/ftplugin/go.lua b/.config/nvim/after/ftplugin/go.lua index cf26a95..38b82fc 100644 --- a/.config/nvim/after/ftplugin/go.lua +++ b/.config/nvim/after/ftplugin/go.lua @@ -1,5 +1,5 @@ -- Tab -vim.opt_local.expandtab = false -- convert tabs to spaces +vim.opt_local.expandtab = false -- don't convert tabs to spaces vim.opt_local.tabstop = 4 -- number of visual spaces per TAB vim.opt_local.softtabstop = 4 -- number of idfk tab when editing vim.opt_local.shiftwidth = 4 -- number of spaces to insert on tab diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index bc312dd..ccaf1ec 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -36,8 +36,10 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) require('lazy').setup({ import = 'plugins' }, { - change_detection = { enabled = true, notify = false }, defaults = { lazy = true }, + -- install = { colorscheme = { 'tokyonight', 'habamax' } }, + change_detection = { enabled = true, notify = false }, + checker = { enabled = true, notify = false }, ui = { icons = { ft = ' ', @@ -60,6 +62,7 @@ require('lazy').setup({ import = 'plugins' }, { 'netrwSettings', 'netrwFileHandlers', 'matchit', + -- "matchparen" 'tar', 'tarPlugin', 'rrhelper', diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index 86547a2..144b591 100644 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,5 +1,4 @@ local set = vim.keymap.set -local silent = { silent = true } ---@param mode string|table ---@param keymap string local function unbind(mode, keymap) @@ -12,33 +11,18 @@ local function toggle_zen() vim.cmd('UndotreeHide') end -local function yank_filepath_to_clipboard(os) +local function yank_filepath_to_clipboard(absolute) return function() local filepath = vim.fn.expand('%:p') - -- TODO: simplify bcz idc about windows anymore - if os == 'linux' then + if not absolute then local home_dir = vim.fn.expand('~') filepath = filepath:gsub(home_dir, '~') - elseif os == 'windows' then - local mnt = '/mnt/' - if filepath:sub(1, #mnt) == mnt then - filepath = filepath:sub(#mnt + 1, #mnt + 1) .. ':' .. filepath:sub(#mnt + 2) - else - filepath = '//wsl.localhost/openSUSE-Tumbleweed' .. filepath - end - filepath = filepath:gsub('/', '\\') end vim.fn.setreg('+', filepath) end end -function RemoveClipboardCR() - local clipboard = vim.fn.getreg('+'):gsub('\r', '') - vim.fn.setreg('+', clipboard) -end - local function paste() - RemoveClipboardCR() local value = vim.fn.getreg('+') if vim.fn.mode() == 'c' then -- value = vim.split(value, '\n')[1] -- only use first line (default with normal pasting) @@ -67,22 +51,22 @@ set('v', '<A-k>', ":m '<-2<cr>gv", { noremap = true }) -- Misc set({ 'n', 'i' }, '<C-a>', '<Esc>ggVG', { desc = 'Visually Highlight [A]ll' }) set('i', '<C-H>', '<C-w>', { desc = 'Ctrl + Backspace to delete word' }) -set('n', '<Esc>', '<cmd>nohlsearch<CR>', silent) +set('n', '<esc>', '<cmd>nohlsearch<cr>', { silent = true }) set({ 'i', 'c' }, '<C-v>', paste) set('n', '<leader>z', toggle_zen, { desc = '[Z]en Mode', silent = true }) +set('n', '<S-h>', '<cmd>bprevious<cr>', { desc = 'Prev Buffer' }) +set('n', '<S-l>', '<cmd>bnext<cr>', { desc = 'Next Buffer' }) +set('n', '<leader><tab>', '<cmd>e #<cr>', { desc = 'Switch to Other Buffer' }) unbind({ 'i', 'n', 'v' }, '<C-r>') set('n', 'U', '<cmd>redo<cr>') set('i', '<C-z>', '<cmd>undo<cr>') set({ 'i', 'n', 'v' }, '<C-q>', '<cmd>wqa<cr>') -set('n', '<leader>yp', yank_filepath_to_clipboard('linux'), { desc = '[Y]oink File [P]ath (linux)' }) -set('n', '<leader>yP', yank_filepath_to_clipboard('windows'), { desc = '[Y]oink File [P]ath (windows)' }) +set('n', '<leader>yp', yank_filepath_to_clipboard(true), { desc = '[Y]oink File [P]ath (linux)' }) +set('n', '<leader>yP', yank_filepath_to_clipboard(false), { desc = '[Y]oink File [P]ath (windows)' }) --- Window Navigation - NO NEED BECAUSE IT CONFLICTS WITH TMUX --- set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) --- set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the down window' }) --- set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the up window' }) --- set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) +-- Terminal +set('t', '<C-t>', '<cmd>close<cr>', { desc = 'Hide Terminal' }) -- Window resizing local resize = 2 @@ -91,6 +75,13 @@ set({ 'n', 't' }, '<C-Up>', string.format('<cmd>resize -%d<CR>', resize), { desc set({ 'n', 't' }, '<C-Down>', string.format('<cmd>resize +%d<CR>', resize), { desc = 'Resize Down' }) set({ 'n', 't' }, '<C-Right>', string.format('<cmd>vertical resize +%d<CR>', resize), { desc = 'Resize Right' }) +-- highlights under cursor +set('n', '<leader>ui', vim.show_pos, { desc = 'Inspect Pos' }) +set('n', '<leader>uI', function() + vim.treesitter.inspect_tree() + vim.api.nvim_input('I') +end, { desc = 'Inspect Tree' }) + -- Keep selection after < and > in visual mode set('v', '<', '<gv') set('v', '>', '>gv') diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua index b7da110..86f1761 100644 --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -3,7 +3,9 @@ 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 +vim.opt.undolevels = 10000 vim.opt.exrc = true -- WARNING: runs .nvim.lua in cwd, which may execute arbitrary code +vim.opt.updatetime = 200 -- save swap file and trigger CursorHold -- Tab vim.opt.expandtab = true -- convert tabs to spaces @@ -12,9 +14,9 @@ vim.opt.softtabstop = 4 -- number of idfk tab when editing vim.opt.shiftwidth = 4 -- number of spaces to insert on tab -- UI +vim.opt.number = true vim.opt.colorcolumn = '80' vim.opt.signcolumn = 'auto:9' -vim.opt.number = true vim.opt.relativenumber = true vim.opt.cursorline = true -- highlight current line vim.opt.splitright = true @@ -24,20 +26,23 @@ vim.opt.list = true vim.opt.listchars = { tab = ' ', trail = '·', nbsp = '␣' } vim.diagnostic.config({ signs = false }) -- disable signcolumn diagnostics vim.opt.fillchars:append({ diff = '╱' }) -- nicer diff view for filled spaces +vim.opt_local.wrap = false +vim.opt.wrap = false +vim.opt.linebreak = true -- wrap lines at convenient points +vim.opt.laststatus = 3 -- global stautsline +vim.opt.smoothscroll = true -- Searching vim.opt.hlsearch = true vim.opt.ignorecase = true vim.opt.smartcase = true +vim.opt.inccommand = 'split' -- shows preview for commands like :%s/from/to -- Misc -vim.opt_local.wrap = false -vim.opt.wrap = false vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 8 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.splitkeep = 'screen' vim.opt.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions' -- Disable warnings for missing language providers |
