aboutsummaryrefslogtreecommitdiff
path: root/config/vim/vimrc
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-07-28 19:30:52 +0200
committerCharles Cabergs <me@cacharle.xyz>2021-07-28 19:30:52 +0200
commite74644dbd343ac1ddf705e3f477932686d09416b (patch)
treed5326be8fd1422754943bd70d0da4fa609f3f1c8 /config/vim/vimrc
parenteccb1ceda9e05e485bdc6366164109b09ed2f09b (diff)
parentb0dff6afa640cc540114a8d83486d47ce8282b5a (diff)
downloaddotfiles-e74644dbd343ac1ddf705e3f477932686d09416b.tar.gz
dotfiles-e74644dbd343ac1ddf705e3f477932686d09416b.tar.bz2
dotfiles-e74644dbd343ac1ddf705e3f477932686d09416b.zip
Merge branch 'master' of github.com:cacharle/dotfiles
Diffstat (limited to 'config/vim/vimrc')
-rw-r--r--config/vim/vimrc19
1 files changed, 18 insertions, 1 deletions
diff --git a/config/vim/vimrc b/config/vim/vimrc
index 7d2441b..f815bbd 100644
--- a/config/vim/vimrc
+++ b/config/vim/vimrc
@@ -270,9 +270,10 @@ augroup vimrc_files
" std::cout << ... << std::endl; shortcut
autocmd Filetype cpp nnoremap <leader>cout istd::cout << << std::endl;<ESC>2F<hi
autocmd Filetype vim setlocal foldmethod=marker " vim fold method to marker
- autocmd FileType haskell set formatprg=stylish-haskell
+ autocmd FileType haskell setlocal formatprg=stylish-haskell
autocmd FileType lisp,html,css,htmldjango setlocal shiftwidth=2
autocmd Filetype markdown nnoremap <leader>r :execute 'silent !pandoc % -o %:r.pdf &' \| redraw! \| echom 'Converting to pdf: ' . expand('%:r') . '.pdf'<CR>
+ autocmd Filetype markdown setlocal textwidth=80
augroup END
" }}}
@@ -335,3 +336,19 @@ nnoremap <leader>ss :setlocal spell!<CR>
hi link juliaFunctionCall Identifier
hi link juliaParDelim Delimiter
+
+nnoremap gf :vsp <cfile><CR>
+
+" from: https://vim.fandom.com/wiki/Autocomplete_with_TAB_when_typing_words
+
+function! TabOrComplete(direction)
+ if col('.') > 1 && strpart(getline('.'), col('.') - 2, 3) =~# '^\w'
+ return a:direction ==# 'next' ? "\<C-n>" : "\<C-p>"
+ else
+ return "\<TAB>"
+ endif
+endfunction
+
+inoremap <TAB> <C-r>=TabOrComplete('next')<CR>
+" st maps Shift-Tab to <ESC>[Z (and it's discouraged to change it)
+inoremap <ESC>[Z <C-r>=TabOrComplete('prev')<CR>