This commit is contained in:
ikolokolnikov committed 2026-06-14 01:09:02 -07:00
1 parent d4c25ea6cb
commit 78ec20d721
2 files changed
+176 -94

No files matched your search

+176
View File
@@ -0,0 +1,176 @@
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"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
require("lazy").setup({
spec = {
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = { signs = false }
},
{
'numToStr/Comment.nvim',
opts = { }
},
{
'lewis6991/gitsigns.nvim',
},
{
'nvim-telescope/telescope.nvim', version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
}
}
},
install = { colorscheme = { "habamax" } },
checker = { enabled = false }, -- automatic updates
})
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.opt.backspace = { "indent", "eol", "start" }
vim.opt.updatetime = 100
vim.opt.signcolumn = "auto"
local map = vim.keymap.set
map("n", "K", "<Nop>", { silent = true })
map("v", ">", ">gv", { silent = true })
map("v", "<", "<gv", { silent = true })
map("v", "J", ":m '>+1<CR>gv=gv", { silent = true })
map("v", "K", ":m '<-2<CR>gv=gv", { silent = true })
map("n", "H", ":bnext<CR>zz", { silent = true })
map("n", "L", ":bprev<CR>zz", { silent = true })
map("n", ",", ":copen<CR>", { silent = true })
map("n", ">", ":cn<CR>", { silent = true })
map("n", "<", ":cp<CR>", { silent = true })
map("n", "\\", ":noh<CR>", { silent = true })
map("n", "E", ":Ex<CR>", { silent = true })
map("n", "<space>z", ":set relativenumber<CR>", { silent = true })
map("n", "<space>x", ":set norelativenumber<CR>", { silent = true })
map("n", "gb", ":make<CR>", { silent = true })
map("n", "gs", ":w<CR>", { silent = true })
map("n", "ghp", ":Gitsigns preview_hunk_inline<CR>", { silent = true })
map("n", "gs", ":w<CR>", { silent = true })
local builtin = require('telescope.builtin')
map('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
map('n', '<leader>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", "<Leader>a", ":Align<CR>", { silent = true })
-94
View File
@@ -1,94 +0,0 @@
filetype plugin indent on
syntax off
"colorscheme wildcharm
colorscheme habamax
set nobackup nowritebackup
set noswapfile
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set smarttab
set mouse=a
set laststatus=2
set scrolloff=5
set ignorecase
set hlsearch
set incsearch
set wrap!
set timeoutlen=1000
set ttimeoutlen=0
set hidden
set wildmenu
set clipboard=unnamed,unnamedplus
set colorcolumn=75
"set backspace=indent,eol,start
set updatetime=100
set signcolumn=auto
:nnoremap <silent> K <Nop>
:vnoremap > >:normal gv<CR>
:vnoremap < <:normal gv<CR>
:vnoremap J :m '>+1<CR>gv=gv
:vnoremap K :m '<-2<CR>gv=gv
:nnoremap H :bnext<CR>zz
:nnoremap L :bprev<CR>zz
:nnoremap , :copen<CR>
:nnoremap > :cn<CR>
:nnoremap < :cp<CR>
:nnoremap \\ :noh<CR>
:nnoremap E :Ex<CR>
:nnoremap <space>z :set relativenumber<CR>
:nnoremap <space>x :set norelativenumber<CR>
xnoremap p "_dP
:nnoremap gb :make<CR>
:nnoremap gs :w<CR>
" Align regex
command! -nargs=? -range Align <line1>,<line2>call AlignSection('<args>')
vnoremap <silent> <Leader>a :Align<CR>
function! AlignSection(regex) range
let extra = 1
let sep = empty(a:regex) ? '=' : a:regex
let maxpos = 0
let section = getline(a:firstline, a:lastline)
for line in section
let pos = match(line, ' *'.sep)
if maxpos < pos
let maxpos = pos
endif
endfor
call map(section, 'AlignLine(v:val, sep, maxpos, extra)')
call setline(a:firstline, section)
endfunction
function! AlignLine(line, sep, maxpos, extra)
let m = matchlist(a:line, '\(.\{-}\) \{-}\('.a:sep.'.*\)')
if empty(m)
return a:line
endif
let spaces = repeat(' ', a:maxpos - strlen(m[1]) + a:extra)
return m[1] . spaces . m[2]
endfunction