diff options
author | Amin Bandali <bandali@kelar.org> | 2024-08-31 14:29:24 -0400 |
---|---|---|
committer | Amin Bandali <bandali@kelar.org> | 2024-08-31 14:29:24 -0400 |
commit | af02b553fbadc4dbee07063248c0e7cdcd2cce25 (patch) | |
tree | 24e8a9ffbfe0249584d96cd1cf920f30f606bff4 | |
parent | c6d8f5f99ec23a6b7cb537c79e716bf5eea5446a (diff) | |
download | configs-af02b553fbadc4dbee07063248c0e7cdcd2cce25.tar.gz configs-af02b553fbadc4dbee07063248c0e7cdcd2cce25.tar.xz configs-af02b553fbadc4dbee07063248c0e7cdcd2cce25.zip |
Add small vimrc
I threw this together back in March for some more reasonable defaults
for vim for the few and far between occasions I do use it. Otherwise
GNU Emacs remains my favourite editor / operating system / way of life
by far. ;)
Diffstat (limited to '')
-rw-r--r-- | .vimrc | 71 |
1 files changed, 71 insertions, 0 deletions
@@ -0,0 +1,71 @@ +set nocompatible + +set laststatus=2 +set encoding=utf-8 +set autoindent +set magic +set ruler +set nowrap +set colorcolumn=+1 +set list listchars=tab:›\ ,extends:→,precedes:← +set ignorecase +set smartcase +set notimeout +set incsearch +set showmatch +set nofoldenable +set lazyredraw +set wildmenu +set spc= + +let mapleader = "," +nnoremap Y y$ +nnoremap <silent><expr> \ (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n" + +inoremap <C-X><C-B> <C-O>:set rl!<CR> + +" for the emacsian in me +nnoremap <C-g> <ESC> +inoremap <C-g> <ESC> +vnoremap <C-g> <ESC> +xnoremap <C-g> <ESC> +snoremap <C-g> <ESC> +cnoremap <C-g> <ESC> +onoremap <C-g> <ESC> + +syntax enable +" highlight StatusLine cterm=none ctermbg=none ctermfg=darkgrey +" highlight StatusLineNC cterm=none ctermbg=none ctermfg=darkgrey +highlight ColorColumn ctermbg=black + +autocmd FileType text,mail,markdown,rst,gitcommit setlocal tw=70 et ts=2 sw=2 + +function! ConflictsHighlight() abort + syntax region conflictStart start=/^<<<<<<< .*$/ end=/^\ze\(=======$\||||||||\)/ + syntax region conflictMiddle start=/^||||||| .*$/ end=/^\ze=======$/ + syntax region conflictEnd start=/^\(=======$\||||||| |\)/ end=/^>>>>>>> .*$/ + + highlight conflictStart ctermbg=red ctermfg=black + highlight conflictMiddle ctermbg=blue ctermfg=black + highlight conflictEnd ctermbg=green cterm=bold ctermfg=black +endfunction + +augroup MyColors + autocmd! + autocmd BufEnter * call ConflictsHighlight() +augroup END + +" --[ from $VIMRUNTIME/defautls.vim ]-- +" When editing a file, always jump to the last known cursor position. +" Don't do it when the position is invalid, when inside an event handler +" (happens when dropping a file on gvim), for a commit or rebase message +" (likely a different one than last time), and when using xxd(1) to filter +" and edit binary files (it transforms input files back and forth, causing +" them to have dual nature, so to speak) +autocmd BufReadPost * + \ let line = line("'\"") + \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit' + \ && index(['xxd', 'gitrebase'], &filetype) == -1 + \ | execute "normal! g`\"" + \ | endif + |