commit 820f58f1b17b097970b7ab2c32a19eb853d03be4
parent 424d76542e875adaade47a96c82c1936841829e2
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 1 Jan 2019 11:56:42 +0100
Vim undo tree plugin
This is gonna save my ass at some point, and it's easier to use than the
default vim undo system (yeah g- and g+ is cool but this is simpler).
Also persistent undos in ~/.vim/undo
Former-commit-id: d038941e7831aa1d273503bcf962a14c1806394c
Diffstat:
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/vim/general.vimrc b/vim/general.vimrc
@@ -14,6 +14,10 @@ set binary
" No swp please, I save all the time
set noswapfile
+" Persistent undos (useful for plugins too)
+set undofile
+set undodir=~/.vim/undo
+
" Hide buffers instead of closing
set hidden
diff --git a/vim/map.vimrc b/vim/map.vimrc
@@ -5,18 +5,21 @@ nnoremap ; :
vnoremap ; :
" NERDTree
-nnoremap <leader>f :NERDTreeToggle<cr>
+nnoremap <leader>f :NERDTreeToggle<CR>
" Tagbar
-nnoremap <leader>t :TagbarToggle<cr>
+nnoremap <leader>t :TagbarToggle<CR>
+" Mundo undo tree (super-undo)
+nnoremap <leader>u :MundoToggle<CR>
" Disable q: cuz I hate it
+" (also C-F does the same)
nnoremap q: <Nop>
" Normal mode shortcuts
-nnoremap <leader>dif :Diff<cr>
-nnoremap <leader>/ :noh<cr>
-nnoremap <leader>b :ls<cr>:b<Space>
+nnoremap <leader>dif :Diff<CR>
+nnoremap <leader>/ :noh<CR>
+nnoremap <leader>b :ls<CR>:b<Space>
" Tab completion
inoremap <expr> <tab> InsertTabWrapper()
@@ -27,14 +30,14 @@ vnoremap < <gv
vnoremap > >gv
" Move visual block
-vnoremap J :m '>+1<cr>gv=gv
-vnoremap K :m '<-2<cr>gv=gv
+vnoremap J :m '>+1<CR>gv=gv
+vnoremap K :m '<-2<CR>gv=gv
" stfu and write the file
cnoremap w!! w !sudo tee > /dev/null %
" and don't break my colours (U for 'unfuck my screen please')
-nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
+nnoremap U :syntax sync fromstart<CR>:redraw!<CR>
" Panic button rot13
nnoremap <leader>qq mzggg?G`z
@@ -46,8 +49,8 @@ nnoremap zh mzzt10<c-u>`z
nnoremap <leader>= mlgg=G`lzz
" Tab mappings
-nnoremap <C-t> :tabnew<cr>
-nnoremap <C-c> :tabclose<cr>
+nnoremap <C-t> :tabnew<CR>
+nnoremap <C-c> :tabclose<CR>
" Window resizing mappings
nnoremap <C-k> <C-w>+
@@ -56,13 +59,13 @@ nnoremap <C-h> <C-W>>
nnoremap <C-l> <C-W><
" Delete hidden buffers
-nnoremap <leader>dh :DeleteHiddenBuffers<cr>
+nnoremap <leader>dh :DeleteHiddenBuffers<CR>
" Switch to alernative buffer
-nnoremap <leader>s :b#<cr>
+nnoremap <leader>s :b#<CR>
" Show hidden symbols
-nnoremap <leader>hs :set list!<cr>
+nnoremap <leader>hs :set list!<CR>
" List marks
nnoremap <leader>mm :<C-u>marks<CR>:normal! `
diff --git a/vim/plugins.vimrc b/vim/plugins.vimrc
@@ -48,6 +48,9 @@ Plug 'vimwiki/vimwiki'
" Git wrapper from tpope
Plug 'tpope/vim-fugitive'
+" Undo tree visualiser
+Plug 'simnalamburt/vim-mundo'
+
" Easy table making (unnecessary because vimwiki has this built in)
" Plug 'dhruvasagar/vim-table-mode'