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
|
let $INITDIR=stdpath('config')
|
||||||
source $XDG_CONFIG_HOME/nvim/init/general.vim
|
source $INITDIR/init/plug.vim
|
||||||
source $XDG_CONFIG_HOME/nvim/init/pluginConfig.vim
|
source $INITDIR/init/general.vim
|
||||||
source $XDG_CONFIG_HOME/nvim/init/keys.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 mouse=a " Enable mouse in all modes
|
||||||
|
|
||||||
set undofile
|
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 clipboard+=unnamedplus " Merge with system clipboard
|
||||||
|
|
||||||
set tabstop=4 shiftwidth=4 " Indentation
|
set tabstop=4 shiftwidth=4 " Indentation
|
||||||
|
|
||||||
" visuals
|
" visuals
|
||||||
set number relativenumber " Relative line numbering on the left
|
set number relativenumber " Relative line numbering on the left
|
||||||
set wrap linebreak
|
set linebreak
|
||||||
set cursorline cursorcolumn
|
set cursorline cursorcolumn
|
||||||
set scrolloff=7 sidescrolloff=20 " Keep some context when scrolling
|
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 json syntax match Comment +\/\/.\+$+ " Comment highlighting in JSON
|
||||||
autocmd Filetype * set formatoptions-=o " Don't automatically comment on o
|
autocmd Filetype * set formatoptions-=o " Don't automatically comment on o
|
||||||
" custom hardcoded types
|
" custom hardcoded types
|
||||||
autocmd BufRead,BufNewFile $SHELL_CONFIG/* set filetype=zsh
|
autocmd BufRead,BufNewFile $CONFIG_SHELLS/*,$CONFIG_ZSH/* setlocal filetype=zsh
|
||||||
autocmd BufRead,BufNewFile www.mixxx.org_wiki* set filetype=dokuwiki scrolloff=1
|
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
|
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
|
" Center on insert mode
|
||||||
autocmd InsertEnter * norm zz
|
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
|
" Save file as root when I forgot to use sudoedit
|
||||||
cnoremap w!! execute 'write !sudo tee % >/dev/null' <bar> edit!
|
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)
|
" 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! FormatJSON %!python -m json.tool
|
||||||
command! DiffSwap :diffsp % " Diff for swap - replaced by 'chrisbra/Recover.vim'
|
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
|
" Sane yanking
|
||||||
map Y y$
|
map Y y$
|
||||||
" Disable Ex mode - https://vi.stackexchange.com/q/457
|
" Disable Ex mode - https://vi.stackexchange.com/q/457
|
||||||
nnoremap Q <nop>
|
nnoremap Q @q
|
||||||
|
|
||||||
let mapleader=" "
|
let mapleader=" "
|
||||||
|
|
||||||
|
nnoremap <leader>" ysiW"
|
||||||
|
|
||||||
" Alias write and quit to leader
|
" Alias write and quit to leader
|
||||||
nnoremap <leader>q :wq<CR>
|
nnoremap <leader>q :wq<CR>
|
||||||
nnoremap <leader>w :w<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>i :setlocal autoindent!<CR>
|
||||||
map <leader>s :setlocal spell!<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,10 +1,13 @@
|
||||||
" Plug
|
" Plug
|
||||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
let plug_install = 0
|
||||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
let autoload_plug_path = stdpath('data') . '/site/autoload/plug.vim'
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
if !filereadable(autoload_plug_path)
|
||||||
|
silent exe '!curl -fL --create-dirs -o ' . autoload_plug_path .
|
||||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
\ ' https://raw.github.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
execute 'source ' . fnameescape(autoload_plug_path)
|
||||||
|
let plug_install = 1
|
||||||
endif
|
endif
|
||||||
|
unlet autoload_plug_path
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
|
|
||||||
|
@ -57,6 +60,13 @@ Plug 'neoclide/coc.nvim', {'branch': 'release' }
|
||||||
Plug 'udalov/kotlin-vim'
|
Plug 'udalov/kotlin-vim'
|
||||||
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
|
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
|
||||||
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
||||||
|
Plug 'mipmip/vim-scimark' " Edit markdown tables
|
||||||
|
Plug 'APZelos/blamer.nvim' " Inline git blame
|
||||||
|
|
||||||
call plug#end()
|
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; }; })
|
lua require 'colorizer'.setup({ '*'; markdown = { names = false; }; })
|
||||||
|
|
||||||
let g:strip_whitespace_on_save=1
|
let g:strip_whitespace_on_save=1
|
||||||
|
autocmd FileType taskedit,crontab,markdown DisableStripWhitespaceOnSave
|
||||||
let g:show_spaces_that_precede_tabs=1
|
let g:show_spaces_that_precede_tabs=1
|
||||||
let g:better_whitespace_skip_empty_lines=1
|
let g:better_whitespace_skip_empty_lines=1
|
||||||
let g:better_whitespace_guicolor=$THEME == 'light' ? 'LightGrey' : 'DarkGrey'
|
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'
|
" 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> w <Plug>CamelCaseMotion_w
|
||||||
map <silent> b <Plug>CamelCaseMotion_b
|
map <silent> b <Plug>CamelCaseMotion_b
|
||||||
map <silent> e <Plug>CamelCaseMotion_e
|
map <silent> e <Plug>CamelCaseMotion_e
|
||||||
|
@ -39,23 +46,29 @@ let g:firenvim_config = {
|
||||||
\ },
|
\ },
|
||||||
\ 'localSettings': {
|
\ 'localSettings': {
|
||||||
\ '.*': {
|
\ '.*': {
|
||||||
\ 'cmdline': 'neovim',
|
\ 'cmdline': 'firenvim',
|
||||||
\ 'priority': 0,
|
\ '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',
|
\ 'takeover': 'always',
|
||||||
\ },
|
\ },
|
||||||
\ '.*notion\.so.*': { 'priority': 1, 'takeover': 'never', },
|
\ '.*notion\.so.*': { 'priority': 9, 'takeover': 'never', },
|
||||||
\ '.*openstreetmap\.org.*': { 'priority': 1, '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')
|
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()
|
autocmd FocusLost,InsertLeave,BufLeave * ++nested call WriteSilent()
|
||||||
function WriteSilent()
|
function WriteSilent()
|
||||||
let tmp=b:better_whitespace_enabled
|
let was_enabled=b:strip_whitespace_on_save
|
||||||
let b:better_whitespace_enabled=0
|
DisableStripWhitespaceOnSave
|
||||||
write
|
write
|
||||||
let b:better_whitespace_enabled=tmp
|
if was_enabled
|
||||||
endfunction
|
EnableStripWhitespaceOnSave
|
||||||
nnoremap <Esc><Esc> :call firenvim#focus_page()<CR>
|
endif
|
||||||
let g:strip_whitespace_on_save=0
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue