config/nvim: Update environment & config
This commit is contained in:
parent
3af2d0703c
commit
dd2ddfc9d1
|
@ -1,4 +1,5 @@
|
|||
source $XDG_CONFIG_HOME/nvim/init/plug.vim
|
||||
source $XDG_CONFIG_HOME/nvim/init/general.vim
|
||||
source $XDG_CONFIG_HOME/nvim/init/pluginConfig.vim
|
||||
source $XDG_CONFIG_HOME/nvim/init/keys.vim
|
||||
let $INITDIR=stdpath('config')
|
||||
source $INITDIR/init/plug.vim
|
||||
source $INITDIR/init/general.vim
|
||||
source $INITDIR/init/pluginConfig.vim
|
||||
source $INITDIR/init/keys.vim
|
||||
|
|
|
@ -2,14 +2,14 @@ set termguicolors
|
|||
set mouse=a " Enable mouse in all modes
|
||||
|
||||
set undofile
|
||||
set wildmode=longest,list,full " Auto-completion
|
||||
set wildmode=longest,list,full " Auto-completion for cmdline
|
||||
set clipboard+=unnamedplus " Merge with system clipboard
|
||||
|
||||
set tabstop=4 shiftwidth=4 " Indentation
|
||||
|
||||
" visuals
|
||||
set number relativenumber " Relative line numbering on the left
|
||||
set wrap linebreak
|
||||
set linebreak
|
||||
set cursorline cursorcolumn
|
||||
set scrolloff=7 sidescrolloff=20 " Keep some context when scrolling
|
||||
|
||||
|
@ -37,11 +37,16 @@ filetype plugin on
|
|||
autocmd FileType json syntax match Comment +\/\/.\+$+ " Comment highlighting in JSON
|
||||
autocmd Filetype * set formatoptions-=o " Don't automatically comment on o
|
||||
" custom hardcoded types
|
||||
autocmd BufRead,BufNewFile $SHELL_CONFIG/* set filetype=zsh
|
||||
autocmd BufRead,BufNewFile www.mixxx.org_wiki* set filetype=dokuwiki scrolloff=1
|
||||
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
|
||||
|
||||
set spelllang=en_us,de_de
|
||||
autocmd FileType markdown setlocal spell " Spell checking in markdown
|
||||
autocmd FileType markdown setlocal wrap spell colorcolumn= " Spell checking & no guiding columns in markdown
|
||||
|
||||
" Center on insert mode
|
||||
autocmd InsertEnter * norm zz
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
let @c = '/^\n
i```Ni```j0/```
lllkxNA'
|
||||
|
||||
" Save file as root when I forgot to use sudoedit
|
||||
cnoremap w!! execute 'write !sudo tee % >/dev/null' <bar> edit!
|
||||
" Write file & source vimrc (really only makes sense from within vimrc to quickly test changes)
|
||||
|
@ -6,18 +8,15 @@ command! WS write <bar> source $MYVIMRC
|
|||
command! FormatJSON %!python -m json.tool
|
||||
command! DiffSwap :diffsp % " Diff for swap - replaced by 'chrisbra/Recover.vim'
|
||||
|
||||
" 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 execute 'silent! 1s/.*/#!\/bin\/sh\r\r'| :startinsert
|
||||
"autocmd BufNewFile * if !empty(&filetype) | execute 'silent! 1s/.*/#!\/usr\/bin\/' . &filetype . '\r\r'| :startinsert | endif
|
||||
|
||||
" Sane yanking
|
||||
map Y y$
|
||||
" Disable Ex mode - https://vi.stackexchange.com/q/457
|
||||
nnoremap Q <nop>
|
||||
nnoremap Q @q
|
||||
|
||||
let mapleader=" "
|
||||
|
||||
nnoremap <leader>" ysiW"
|
||||
|
||||
" Alias write and quit to leader
|
||||
nnoremap <leader>q :wq<CR>
|
||||
nnoremap <leader>w :w<CR>
|
||||
|
@ -48,5 +47,8 @@ map <leader>C :setlocal formatoptions=cro<CR>
|
|||
|
||||
map <leader>i :setlocal autoindent!<CR>
|
||||
map <leader>s :setlocal spell!<CR>
|
||||
map <leader>ls :setlocal colorcolumn=81,121 nowrap<CR>
|
||||
map <leader>lw :setlocal colorcolumn=81 textwidth=80<CR>
|
||||
map <leader>ln :setlocal colorcolumn= textwidth=0 wrap<CR>
|
||||
|
||||
" }}}
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
" Plug
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
let plug_install = 0
|
||||
let autoload_plug_path = stdpath('data') . '/site/autoload/plug.vim'
|
||||
if !filereadable(autoload_plug_path)
|
||||
silent exe '!curl -fL --create-dirs -o ' . autoload_plug_path .
|
||||
\ ' https://raw.github.com/junegunn/vim-plug/master/plug.vim'
|
||||
execute 'source ' . fnameescape(autoload_plug_path)
|
||||
let plug_install = 1
|
||||
endif
|
||||
unlet autoload_plug_path
|
||||
|
||||
call plug#begin()
|
||||
|
||||
" Editing
|
||||
" text objects
|
||||
Plug 'xerus2000/argtextobj.vim' " arguments in brackets as text objects
|
||||
Plug 'tpope/vim-surround' " edit surroundings - cs, ds, ys
|
||||
Plug 'bkad/CamelCaseMotion' " move through camel case words
|
||||
Plug 'xerus2000/argtextobj.vim' " arguments in brackets as text objects
|
||||
Plug 'tpope/vim-surround' " edit surroundings - cs, ds, ys
|
||||
Plug 'bkad/CamelCaseMotion' " move through camel case words
|
||||
" commands
|
||||
Plug 'inkarkat/vim-ReplaceWithRegister' " gr to replace with register
|
||||
Plug 'tpope/vim-commentary' " gc to comment out (gcap for paragraph)
|
||||
|
@ -33,19 +36,19 @@ Plug 'jreybert/vimagit' " Magit for vim - git stage individual changes
|
|||
Plug 'doy/vim-diff-changes' " Commands for diffing - :DiffAgainstFilesystem :DiffAgainstVCS :DiffStop
|
||||
Plug 'junegunn/fzf' " File selection with :FZF
|
||||
" Browse
|
||||
Plug 'tyru/open-browser.vim' " :OpenBrowser, :OpenBrowserSearch
|
||||
Plug 'tyru/open-browser.vim' " :OpenBrowser, :OpenBrowserSearch
|
||||
Plug 'tyru/open-browser-github.vim'
|
||||
|
||||
" QOL
|
||||
Plug 'farmergreg/vim-lastplace' " Automatically jump to last edit position
|
||||
Plug 'chrisbra/Recover.vim' " Add Recover options for swap files
|
||||
Plug 'farmergreg/vim-lastplace' " Automatically jump to last edit position
|
||||
Plug 'chrisbra/Recover.vim' " Add Recover options for swap files
|
||||
Plug 'ntpeters/vim-better-whitespace' " Tools for trailing whitespace & mixed indents
|
||||
|
||||
" Aesthetic
|
||||
Plug 'vim-airline/vim-airline' " Status bar on the bottom
|
||||
Plug 'psliwka/vim-smoothie' " Smooth scrolling
|
||||
Plug 'romainl/vim-cool' " Automatically stop highlighting search results when moving - https://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting
|
||||
Plug 'airblade/vim-gitgutter' " Git info on the left
|
||||
Plug 'vim-airline/vim-airline' " Status bar on the bottom
|
||||
Plug 'psliwka/vim-smoothie' " Smooth scrolling
|
||||
Plug 'romainl/vim-cool' " Automatically stop highlighting search results when moving - https://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting
|
||||
Plug 'airblade/vim-gitgutter' " Git info on the left
|
||||
Plug 'norcalli/nvim-colorizer.lua' " Highlights color literals
|
||||
" Visual indent guides
|
||||
Plug 'nathanaelkane/vim-indent-guides'
|
||||
|
@ -57,6 +60,13 @@ Plug 'neoclide/coc.nvim', {'branch': 'release' }
|
|||
Plug 'udalov/kotlin-vim'
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
|
||||
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
||||
Plug 'mipmip/vim-scimark' " Edit markdown tables
|
||||
Plug 'APZelos/blamer.nvim' " Inline git blame
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Install plugins automatically after installing plug
|
||||
if plug_install
|
||||
PlugInstall --sync
|
||||
endif
|
||||
unlet plug_install
|
||||
|
|
|
@ -6,12 +6,19 @@ command! PU PlugUpdate | PlugUpgrade
|
|||
lua require 'colorizer'.setup({ '*'; markdown = { names = false; }; })
|
||||
|
||||
let g:strip_whitespace_on_save=1
|
||||
autocmd FileType taskedit,crontab,markdown DisableStripWhitespaceOnSave
|
||||
let g:show_spaces_that_precede_tabs=1
|
||||
let g:better_whitespace_skip_empty_lines=1
|
||||
let g:better_whitespace_guicolor=$THEME == 'light' ? 'LightGrey' : 'DarkGrey'
|
||||
autocmd FileType taskedit,markdown DisableWhitespace
|
||||
" see https://github.com/ntpeters/vim-better-whitespace/issues/134 - autocmd OptionSet background let g:better_whitespace_guicolor=&background == 'light' ? 'LightYellow' : 'Brown'
|
||||
|
||||
let g:blamer_enabled = 1
|
||||
let g:blamer_template = '<committer>: <summary> • <commit-short> <committer-time>'
|
||||
let g:blamer_relative_time = 1
|
||||
let g:blamer_delay = 300
|
||||
" let g:blamer_show_in_visual_modes = 0
|
||||
|
||||
" remap movement commands to respect CamelCase
|
||||
map <silent> w <Plug>CamelCaseMotion_w
|
||||
map <silent> b <Plug>CamelCaseMotion_b
|
||||
map <silent> e <Plug>CamelCaseMotion_e
|
||||
|
@ -39,23 +46,29 @@ let g:firenvim_config = {
|
|||
\ },
|
||||
\ 'localSettings': {
|
||||
\ '.*': {
|
||||
\ 'cmdline': 'neovim',
|
||||
\ 'cmdline': 'firenvim',
|
||||
\ 'priority': 0,
|
||||
\ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]), div[role="textbox"]',
|
||||
\ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]), div[role="textbox"]:not([aria-label="Search"])',
|
||||
\ 'takeover': 'always',
|
||||
\ },
|
||||
\ '.*notion\.so.*': { 'priority': 1, 'takeover': 'never', },
|
||||
\ '.*openstreetmap\.org.*': { 'priority': 1, 'takeover': 'never', },
|
||||
\ '.*notion\.so.*': { 'priority': 9, 'takeover': 'never', },
|
||||
\ '.*docs\.google\.com.*': { 'priority': 9, 'takeover': 'never', },
|
||||
\ '.*mail\.protonmail\.com.*': { 'priority': 9, 'takeover': 'never', },
|
||||
\ '.*cloud.atomtoast.xyz.*': { 'priority': 9, 'takeover': 'never', },
|
||||
\ }
|
||||
\ }
|
||||
if exists('g:started_by_firenvim')
|
||||
let g:smoothie_no_default_mappings=1 "extremely slow, see https://github.com/psliwka/vim-smoothie/issues/17
|
||||
|
||||
nnoremap <Esc><Esc> :call firenvim#focus_page()<CR>
|
||||
|
||||
autocmd FocusLost,InsertLeave,BufLeave * ++nested call WriteSilent()
|
||||
function WriteSilent()
|
||||
let tmp=b:better_whitespace_enabled
|
||||
let b:better_whitespace_enabled=0
|
||||
let was_enabled=b:strip_whitespace_on_save
|
||||
DisableStripWhitespaceOnSave
|
||||
write
|
||||
let b:better_whitespace_enabled=tmp
|
||||
if was_enabled
|
||||
EnableStripWhitespaceOnSave
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <Esc><Esc> :call firenvim#focus_page()<CR>
|
||||
let g:strip_whitespace_on_save=0
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue