workspace/arch-user/config/vim/vimrc
2025-04-20 21:36:44 +00:00

135 lines
2.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
"###########################################
"############## 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 -> k
noremap e k
noremap E K
noremap! <C-e> <C-k>
" i -> j
noremap i j
noremap I J
noremap! <C-i> <C-j>
" 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=йЙцЦуУкКеЕнНгГшШщЩзЗхХъЪфФыЫвВаАпПрРоОлЛдДжЖэЭяЯчЧсСмМиИтТьЬбБюЮ.\\,;qQwWfFpPbBjJlLuUyY;:[{]}aArRsStTgGmMnNeEiIoO'\"xXcCdDvVzZkKhH\\,<.>/?
noremap о ь
noremap О Ь
noremap <C-о> <C-ь>
noremap л т
noremap Л Т
noremap <C-л> <C-т>
noremap д н
noremap Д Н
noremap <C-д> <C-н>
noremap ж г
noremap Ж Г
noremap <C-ж> <C-г>
noremap т о
noremap Т О
noremap <C-т> <C-о>
noremap г д
noremap Г Д
noremap <C-г> <C-д>
noremap ь ж
noremap Ь Ж
noremap <C-ь> <C-ж>
noremap н л
noremap Н Л
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 }}
"################################