2020-06-26 21:23:12 +00:00
|
|
|
set termguicolors
|
2021-01-23 19:22:18 +00:00
|
|
|
set mouse=nvh " Disable mouse in insert mode to allow middle-click paste in remote session - https://vi.stackexchange.com/q/23080
|
2020-06-26 21:23:12 +00:00
|
|
|
set clipboard+=unnamedplus " Merge with system clipboard
|
|
|
|
|
2021-01-27 10:49:57 +00:00
|
|
|
set shiftwidth=2 expandtab " Default simple indentation
|
2021-05-08 17:57:09 +00:00
|
|
|
set wildmode=longest,list,full " Auto-completion for cmdline
|
|
|
|
set splitright diffopt+=vertical,filler
|
|
|
|
|
|
|
|
" matchpairs
|
|
|
|
set showmatch " Highlight matchpairs
|
|
|
|
set matchpairs+=<:> " More pairings for '%'
|
2020-06-26 21:23:12 +00:00
|
|
|
|
|
|
|
" visuals
|
2021-05-08 17:57:09 +00:00
|
|
|
set number relativenumber
|
|
|
|
set linebreak " Wrap at word boundaries
|
2020-06-26 21:23:12 +00:00
|
|
|
set scrolloff=7 sidescrolloff=20 " Keep some context when scrolling
|
|
|
|
|
2021-05-08 17:57:09 +00:00
|
|
|
set cursorline cursorcolumn
|
2020-06-26 21:23:12 +00:00
|
|
|
set colorcolumn=81,121
|
|
|
|
highlight ColorColumn ctermbg=grey guibg=#888888
|
|
|
|
" call matchadd('ColorColumn', '\%81v', 100)
|
|
|
|
|
|
|
|
" search
|
|
|
|
set incsearch hlsearch " Handier search, even though nvim seems to enable it by default
|
|
|
|
set ignorecase smartcase " Only search case-sensitive when searching with uppercase
|
2021-05-08 17:57:09 +00:00
|
|
|
set inccommand=split " Replace preview in separate window
|
2020-06-26 21:23:12 +00:00
|
|
|
|
|
|
|
" Folding
|
|
|
|
set foldmethod=marker " Use triple curly braces for folds
|
|
|
|
set foldopen+=jump " Automatically open folds on jump
|
|
|
|
|
2021-05-08 17:57:09 +00:00
|
|
|
" persist undo & backup files
|
|
|
|
set undofile
|
|
|
|
set backup
|
|
|
|
let &backupdir=expand(stdpath('data') . '/backup')
|
|
|
|
if !isdirectory(&backupdir)
|
|
|
|
execute "!mkdir " . &backupdir
|
|
|
|
endif
|
|
|
|
let &backupext="_" . strftime("%y%m%dT%H%M")
|
|
|
|
|
2020-06-26 21:23:12 +00:00
|
|
|
" FILETYPES
|
|
|
|
syntax on
|
|
|
|
filetype plugin on
|
2020-09-19 07:33:31 +00:00
|
|
|
" comments
|
2021-02-10 17:04:04 +00:00
|
|
|
autocmd Filetype * setlocal formatoptions-=o | setlocal formatoptions+=qjln12r " Change comment behavior
|
2020-09-19 07:33:31 +00:00
|
|
|
autocmd Filetype json syntax match Comment +\/\/.\+$+ " Comment highlighting in JSON
|
|
|
|
autocmd Filetype markdown let &comments = "b:*,b:-,b:+," . &comments
|
2020-06-26 21:23:12 +00:00
|
|
|
" custom hardcoded types
|
2020-09-04 10:02:34 +00:00
|
|
|
autocmd BufRead,BufNewFile $CONFIG_SHELLS/*,$CONFIG_ZSH/* setlocal filetype=zsh
|
|
|
|
autocmd BufRead $XDG_CONFIG_HOME/yadm/bootstrap setlocal filetype=sh
|
|
|
|
|
|
|
|
" shebang shortcut - https://www.reddit.com/r/vim/comments/4z7z7s/add_shebang_lines_to_your_vim_files_automatically/d6v7op8 and https://stackoverflow.com/a/52135425
|
|
|
|
inoreabbrev <expr> #!! "#!/usr/bin/env" . (empty(&filetype) ? '' : ' '.&filetype)
|
|
|
|
autocmd BufNewFile *.sh,$HOME/.local/bin/* execute 'silent! 1s/.*/#!\/bin\/sh\r\r'| setlocal filetype=sh | :startinsert
|
|
|
|
"autocmd BufNewFile * if !empty(&filetype) | execute 'silent! 1s/.*/#!\/usr\/bin\/' . &filetype . '\r\r'| :startinsert | endif
|
2020-06-26 21:23:12 +00:00
|
|
|
|
|
|
|
set spelllang=en_us,de_de
|
2021-02-10 17:04:04 +00:00
|
|
|
autocmd BufEnter *.txt,*jrnl* setlocal formatoptions+=b textwidth=78 ts=4 sw=4
|
2020-11-26 19:39:12 +00:00
|
|
|
autocmd FileType markdown setlocal wrap spell colorcolumn= " Spell checking & no guiding columns in markdown
|
2020-06-26 21:23:12 +00:00
|
|
|
|
|
|
|
" Center on insert mode
|
|
|
|
autocmd InsertEnter * norm zz
|