From 69214f1c1152d2badb5d42b8fa4f0166c6fc1fdb Mon Sep 17 00:00:00 2001 From: igor Date: Mon, 15 Jun 2026 01:01:59 -0700 Subject: [PATCH] Update nvim. --- nvim/init.lua | 192 ++++++++++++++++---------------------------------- 1 file changed, 62 insertions(+), 130 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 2685a0b..3452121 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,3 +1,4 @@ +----- Plugins ------------------------------------------------------------- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" @@ -14,9 +15,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -vim.g.mapleader = " " -vim.g.maplocalleader = "\\" - require("lazy").setup({ spec = { { @@ -37,140 +35,74 @@ require("lazy").setup({ 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, } - } + }, + { + 'Vonr/align.nvim', + branch = "v2", + lazy = true, + init = function() + -- mappings here... + end + }, }, install = { colorscheme = { "habamax" } }, checker = { enabled = false }, -- automatic updates }) - - +----- Settings ------------------------------------------------------------ vim.cmd("filetype plugin indent on") - ---vim.cmd("syntax off") - --- vim.cmd("colorscheme wildcharm") -vim.cmd("colorscheme habamax") - -vim.opt.backup = false -vim.opt.writebackup = false -vim.opt.swapfile = false - -vim.opt.number = true - -vim.opt.tabstop = 8 -vim.opt.shiftwidth = 4 -vim.opt.softtabstop = 4 -vim.opt.expandtab = true -vim.opt.autoindent = true -vim.opt.smarttab = true - -vim.opt.mouse = "a" - -vim.opt.laststatus = 2 - -vim.opt.scrolloff = 5 - -vim.opt.ignorecase = true -vim.opt.hlsearch = true -vim.opt.incsearch = true - -vim.opt.wrap = false - -vim.opt.timeoutlen = 1000 -vim.opt.ttimeoutlen = 0 -vim.opt.hidden = true -vim.opt.wildmenu = true -vim.opt.clipboard = "unnamed,unnamedplus" -vim.opt.colorcolumn = "75" +vim.cmd("colorscheme habamax") -- or wildchart +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.swapfile = false +vim.opt.number = true +vim.opt.tabstop = 8 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.opt.expandtab = true +vim.opt.autoindent = true +vim.opt.smarttab = true +vim.opt.mouse = "a" +vim.opt.laststatus = 2 +vim.opt.scrolloff = 5 +vim.opt.ignorecase = true +vim.opt.hlsearch = true +vim.opt.incsearch = true +vim.opt.wrap = false +vim.opt.timeoutlen = 1000 +vim.opt.ttimeoutlen = 0 +vim.opt.hidden = true +vim.opt.wildmenu = true +vim.opt.clipboard = "unnamed,unnamedplus" +vim.opt.colorcolumn = "75" -- vim.opt.backspace = { "indent", "eol", "start" } +vim.opt.updatetime = 100 +vim.opt.signcolumn = "auto" +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" -vim.opt.updatetime = 100 -vim.opt.signcolumn = "auto" - +----- Keybinds ------------------------------------------------------------ local map = vim.keymap.set - -map("n", "K", "", { silent = true }) - -map("v", ">", ">gv", { silent = true }) -map("v", "<", "+1gv=gv", { silent = true }) -map("v", "K", ":m '<-2gv=gv", { silent = true }) - -map("n", "H", ":bnextzz", { silent = true }) -map("n", "L", ":bprevzz", { silent = true }) - -map("n", ",", ":copen", { silent = true }) -map("n", ">", ":cn", { silent = true }) -map("n", "<", ":cp", { silent = true }) - -map("n", "\\", ":noh", { silent = true }) - -map("n", "E", ":Ex", { silent = true }) - -map("n", "z", ":set relativenumber", { silent = true }) -map("n", "x", ":set norelativenumber", { silent = true }) - -map("n", "gb", ":make", { silent = true }) -map("n", "gs", ":w", { silent = true }) - -map("n", "ghp", ":Gitsigns preview_hunk_inline", { silent = true }) -map("n", "gs", ":w", { silent = true }) - -local builtin = require('telescope.builtin') -map('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) -map('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) - --- Align command -local function align_line(line, sep, maxpos, extra) - local lhs, rhs = line:match("^(.-)%s*(" .. sep .. ".*)$") - - if not lhs then - return line - end - - local spaces = string.rep(" ", maxpos - #lhs + extra) - return lhs .. spaces .. rhs -end - -local function align_section(opts) - local sep = opts.args ~= "" and opts.args or "=" - local extra = 1 - - local lines = vim.api.nvim_buf_get_lines( - 0, - opts.line1 - 1, - opts.line2, - false - ) - - local maxpos = 0 - - for _, line in ipairs(lines) do - local s, _ = line:find("%s*" .. sep) - if s and (s - 1) > maxpos then - maxpos = s - 1 - end - end - - for i, line in ipairs(lines) do - lines[i] = align_line(line, sep, maxpos, extra) - end - - vim.api.nvim_buf_set_lines( - 0, - opts.line1 - 1, - opts.line2, - false, - lines - ) -end - -vim.api.nvim_create_user_command("Align", align_section, { - nargs = "?", - range = true, -}) - -map("v", "a", ":Align", { silent = true }) +local NS = { noremap = true, silent = true } +map("n", "K", "", NS) +map("v", ">", ">gv", NS) +map("v", "<", "+1gv=gv", NS) +map("v", "K", ":m '<-2gv=gv", NS) +map("n", "H", ":bnextzz", NS) +map("n", "L", ":bprevzz", NS) +map("n", ",", ":copen", NS) +map("n", ">", ":cn", NS) +map("n", "<", ":cp", NS) +map("n", "\\", ":noh", NS) +map("n", "E", ":Ex", NS) +map("n", "z", ":set relativenumber", NS) +map("n", "x", ":set norelativenumber", NS) +map("n", "gb", ":make", NS) +map("n", "gs", ":w", NS) +map("n", "ghp", ":Gitsigns preview_hunk_inline", NS) +map("n", "gs", ":w", NS) +map('n', 'ff', function() require('telescope.builtin').find_files() end, NS) +map('n', 'fg', function() require('telescope.builtin').live_grep() end, NS) +map('x', 'ga', function() require('align').align_to_string({ preview = true, regex = false }) end, NS)