workspace/arch-user/config/vim/vimrc
2025-06-12 20:21:33 +00:00

167 lines
3.6 KiB
VimL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"########## system ###########
set nocompatible
set ttyfast
set encoding=utf-8
set mouse=a
set autoread
au FocusGained,BufEnter * silent! checktime
"#############################
"######### generic ###########
" status line
set showmode
set showcmd
set ruler
" syntax hl
syntax enable
filetype on
filetype plugin on
" lines
set number
set relativenumber
set numberwidth=3
set wrap
set showmatch " brackets
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
" tabs
set shiftwidth=4
set tabstop=4
set softtabstop=0
set noexpandtab
" scroll
set scrolloff=5
" commands
set wildmenu
set wildmode=list:longest,full
set gdefault
" colors
set t_Co=16
set notermguicolors
set t_RV= " bugfix
" new
highlight LineNr ctermfg=5 ctermbg=none
autocmd VimEnter * highlight SignColumn ctermbg=none
" fg magenta (5) -> blue (4)
highlight Title term=bold ctermfg=4 gui=bold
highlight Special term=bold ctermfg=4
highlight PreProc term=underline ctermfg=4
highlight Underlined term=underline cterm=underline ctermfg=4 gui=underline
" fg blue (4 or 12) -> magenta (5)
highlight SpecialKey term=bold ctermfg=5
highlight Directory term=bold ctermfg=5
highlight Folded term=standout ctermfg=5 ctermbg=7
highlight FoldColumn term=standout ctermfg=5 ctermbg=7
highlight SignColumn term=standout ctermfg=5 ctermbg=7
highlight Comment term=bold ctermfg=5
highlight NonText term=bold ctermfg=5 gui=bold
highlight DiffDelete term=bold ctermfg=5 ctermbg=14 gui=bold
highlight Changed ctermfg=5
" bg
highlight SpellCap cterm=underline ctermfg=9 ctermbg=none gui=undercurl
"###########################################
"############## file-specific ###############
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
autocmd FileType markdown setlocal complete+=kspell
autocmd FileType gitcommit setlocal complete+=kspell
"############################################
"####### remap - colemak-dh #######
" n -> h
noremap n h
noremap N H
noremap! <C-n> <C-h>
" e -> j
noremap e j
noremap E J
noremap! <C-e> <C-j>
" i -> k
noremap i k
noremap I K
noremap! <C-i> <C-k>
" o -> l
noremap o l
noremap O L
noremap! <C-o> <C-l>
" k -> n
noremap k n
noremap K N
noremap! <C-k> <C-n>
" j -> e
noremap j e
noremap J E
noremap! <C-j> <C-e>
" l -> i
noremap l i
noremap L I
noremap! <C-l> <C-i>
" h -> o
noremap h o
noremap H O
noremap! <C-h> <C-o>
"#################################
"####### custom commands #########
" W - Save file as superuser
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
"#################################
"######### localization ##########
set langmap=ьЬыЫфФпПбБжЖлЛуУяЯаАрРсСтТгГмМнНеЕиИоОчЧцЦдДвВзЗкКхХ;qQwWfFpPbBjJlLuUyYaArRsStTgGmMnNeEiIoOxXcCdDvVzZkKhH
" n -> h
noremap н х
noremap Н Х
noremap! <C-н> <C-х>
" e -> j
noremap е ж
noremap Е Ж
noremap! <C-е> <C-ж>
" i -> k
noremap и к
noremap И К
noremap! <C-и> <C-к>
" o -> l
noremap о л
noremap О Л
noremap! <C-о> <C-л>
" k -> n
noremap к н
noremap К Н
noremap! <C-к> <C-н>
" j -> e
noremap й е
noremap Й Е
noremap! <C-й> <C-е>
" l -> i
noremap л и
noremap Л И
noremap! <C-л> <C-и>
" h -> o
noremap х о
noremap Х O
noremap! <C-х> <C-о>
"#################################
"############# hacks #############
{{ if ne .Env.IS_COMPAT "1" }}
autocmd TextYankPost * if (v:event.operator == 'y' || v:event.operator == 'd') | silent! execute 'call system("wl-copy", @")' | endif
nnoremap p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
{{ end }}
"################################