config/nvim: add FoldCycle

This commit is contained in:
xeruf 2022-02-12 09:37:07 +01:00
parent d486261ea8
commit 4b87a10bd9
2 changed files with 11 additions and 1 deletions

View File

@ -52,7 +52,7 @@ 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# '| setlocal filetype=sh | :startinsert
autocmd BufNewFile *.sh,$HOME/.local/bin/* execute 'silent! 1s/.*/#!\/bin\/sh -e\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

View File

@ -21,6 +21,16 @@ noremap q: <Nop>
" Alias replace all to S
nnoremap S :%s//gI<Left><Left><Left>
" TODO first only open current one
function FoldCycle()
if &foldlevel
:normal zm
else
:normal zR
endif
endfunction
nnoremap <S-TAB> :call FoldCycle()<CR>
" Jump around without shift
nnoremap gl $
nnoremap gh 0