aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-03-09 21:35:05 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-03-09 21:35:05 -0300
commit75836c0435068b1edab7b07739b311d0180130fd (patch)
tree400c90f688682b762f85da6ee572e016025d387a
parent43ce9016623ab3593fb092e8f216d8c0fc9c9096 (diff)
downloadvim-75836c0435068b1edab7b07739b311d0180130fd.tar.gz
vim-75836c0435068b1edab7b07739b311d0180130fd.tar.bz2
Fix: some enhancements
-rw-r--r--vimrc.dot.link239
1 files changed, 122 insertions, 117 deletions
diff --git a/vimrc.dot.link b/vimrc.dot.link
index 21764e5..114386d 100644
--- a/vimrc.dot.link
+++ b/vimrc.dot.link
@@ -20,6 +20,7 @@ set shortmess+=I
set ignorecase
set smartcase
filetype indent off
+let mapleader="-"
" Window title handling
set title
@@ -28,7 +29,10 @@ set titlestring=vim:\ %F
" See http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
"set autochdir
-autocmd BufEnter * silent! lcd %:p:h
+augroup changedir
+ autocmd!
+ autocmd BufEnter * silent! lcd %:p:h
+augroup END
" Thanks to http://stackoverflow.com/questions/1673649/vimrc-action-onclose
function! ResetTitle(title)
@@ -161,142 +165,144 @@ let g:syntastic_mode_map={ 'mode': 'passive',
set timeoutlen=0 ttimeoutlen=0
" Write, quit and close shortcuts using Esc <key> notation (works also with <Alt-key>)
-nmap <ESC>n :tabnew<CR>
-nmap <ESC>t :NERDTree
-nmap <ESC>T :T
-"nmap <ESC>q :wqa<CR>
-"map <ESC>c :wqa<CR>
-nmap <ESC>f :wq<CR>
-nmap <ESC>c :tabclose<CR>
-"map <ESC>e :tabclose<CR>
-nmap <ESC>b :NERDTreeFromBookmark
-nmap <ESC>B :B
-nmap <ESC>s :OpenSession
-"nmap <ESC>m :q!<CR>
+nnoremap <ESC>n :tabnew<CR>
+nnoremap <ESC>t :NERDTree
+nnoremap <ESC>T :T
+"nnoremap <ESC>q :wqa<CR>
+"noremap <ESC>c :wqa<CR>
+nnoremap <ESC>f :wq<CR>
+nnoremap <ESC>c :tabclose<CR>
+"noremap <ESC>e :tabclose<CR>
+nnoremap <ESC>b :NERDTreeFromBookmark
+nnoremap <ESC>B :B
+nnoremap <ESC>s :OpenSession
+"nnoremap <ESC>m :q!<CR>
" We're closing the buffer instead of just the window to avoid slowness due to too many opened buffers
-nmap <ESC>m :bd<CR>
-nmap <ESC>w :w<CR>
-nmap <ESC>u :!up<CR>
-imap <ESC>n <ESC>:tabnew<CR>
-imap <ESC>t <ESC>:NERDTree
-imap <ESC>t <ESC>:T
-"imap <ESC>q <ESC>:wqa<CR>
-"map <ESC>c <ESC>:wqa<CR>
-imap <ESC>f <ESC>:wq<CR>
-imap <ESC>c <ESC>:tabclose<CR>
-"map <ESC>e <ESC>:tabclose<CR>
-"imap <ESC>m <ESC>:q!<CR>
+nnoremap <ESC>m :bd<CR>
+nnoremap <ESC>w :w<CR>
+nnoremap <ESC>u :!up<CR>
+inoremap <ESC>n <ESC>:tabnew<CR>
+inoremap <ESC>t <ESC>:NERDTree
+inoremap <ESC>t <ESC>:T
+"inoremap <ESC>q <ESC>:wqa<CR>
+"noremap <ESC>c <ESC>:wqa<CR>
+inoremap <ESC>f <ESC>:wq<CR>
+inoremap <ESC>c <ESC>:tabclose<CR>
+"noremap <ESC>e <ESC>:tabclose<CR>
+"inoremap <ESC>m <ESC>:q!<CR>
" We're closing the buffer instead of just the window to avoid slowness due to too many opened buffers
-imap <ESC>m <ESC>:bd<CR>
-imap <ESC>w <ESC>:w<CR>
+inoremap <ESC>m <ESC>:bd<CR>
+inoremap <ESC>w <ESC>:w<CR>
" Write, quit and close shortcuts using Alt-key combo notation
-"map n :tabnew<CR>
-"map t :OpenNERDTree<CR>
-"map q :wqa<CR>
-"map c :wqa<CR>
-"map f :wq<CR>
-"map c :tabclose<CR>
-"map e :tabclose<CR>
-"nmap b :NERDTreeFromBookmark
-"nmap B :B
-"nmap s :OpenSession
-"map m :q!<CR>
-"map w :w<CR>
-"map u :!up<CR>
-"imap n <ESC>:tabnew<CR>
-"imap t <ESC>:OpenNERDTree<CR>
-"imap q <ESC>:wqa<CR>
-"imap c <ESC>:wqa<CR>
-"imap f <ESC>:wq<CR>
-"imap c <ESC>:tabclose<CR>
-"imap e <ESC>:tabclose<CR>
-"imap m <ESC>:q!<CR>
-"imap w <ESC>:w<CR>
+"noremap n :tabnew<CR>
+"noremap t :OpenNERDTree<CR>
+"noremap q :wqa<CR>
+"noremap c :wqa<CR>
+"noremap f :wq<CR>
+"noremap c :tabclose<CR>
+"noremap e :tabclose<CR>
+"nnoremap b :NERDTreeFromBookmark
+"nnoremap B :B
+"nnoremap s :OpenSession
+"noremap m :q!<CR>
+"noremap w :w<CR>
+"noremap u :!up<CR>
+"inoremap n <ESC>:tabnew<CR>
+"inoremap t <ESC>:OpenNERDTree<CR>
+"inoremap q <ESC>:wqa<CR>
+"inoremap c <ESC>:wqa<CR>
+"inoremap f <ESC>:wq<CR>
+"inoremap c <ESC>:tabclose<CR>
+"inoremap e <ESC>:tabclose<CR>
+"inoremap m <ESC>:q!<CR>
+"inoremap w <ESC>:w<CR>
" Write, quit and close shortcuts using Ctrl-key combos
" We're using these due to a conflict with wyrd(1)
-"nmap <C-n> :tabnew<CR>
-"nmap <C-t> :OpenNERDTree<CR>
-"nmap <C-q> :wqa<CR>
-"nmap <C-c> :wqa<CR>
-"nmap <C-f> :wq<CR>
-"nmap <C-c> :tabclose<CR>
-"nmap <C-e> :tabclose<CR>
-"nmap <C-b> :NERDTreeFromBookmark
-"nmap <C-B> :B
-"nmap <C-s> :OpenSession
-"nmap <C-m> :q!<CR>
-"nmap <C-w> :w<CR>
-"imap <C-n> <ESC>:tabnew<CR>
-"imap <C-t> <ESC>:OpenNERDTree<CR>
-"imap <C-q> <ESC>:wqa<CR>
-"imap <C-c> <ESC>:wqa<CR>
-"imap <C-f> <ESC>:wq<CR>
-"imap <C-c> <ESC>:tabclose<CR>
-"imap <C-e> <ESC>:tabclose<CR>
-"imap <C-m> <ESC>:q!<CR>
-"imap <C-w> <ESC>:w<CR>
+"nnoremap <C-n> :tabnew<CR>
+"nnoremap <C-t> :OpenNERDTree<CR>
+"nnoremap <C-q> :wqa<CR>
+"nnoremap <C-c> :wqa<CR>
+"nnoremap <C-f> :wq<CR>
+"nnoremap <C-c> :tabclose<CR>
+"nnoremap <C-e> :tabclose<CR>
+"nnoremap <C-b> :NERDTreeFromBookmark
+"nnoremap <C-B> :B
+"nnoremap <C-s> :OpenSession
+"nnoremap <C-m> :q!<CR>
+"nnoremap <C-w> :w<CR>
+"inoremap <C-n> <ESC>:tabnew<CR>
+"inoremap <C-t> <ESC>:OpenNERDTree<CR>
+"inoremap <C-q> <ESC>:wqa<CR>
+"inoremap <C-c> <ESC>:wqa<CR>
+"inoremap <C-f> <ESC>:wq<CR>
+"inoremap <C-c> <ESC>:tabclose<CR>
+"inoremap <C-e> <ESC>:tabclose<CR>
+"inoremap <C-m> <ESC>:q!<CR>
+"inoremap <C-w> <ESC>:w<CR>
" Write, quit and close shortcuts
-map q :wqa <CR>
-"map f :wq <CR>
-"map t :tabclose <CR>
-"map m :q! <CR>
-"map w :w <CR>
-map h :tabnew<CR>
+noremap q :wqa <CR>
+"noremap f :wq <CR>
+"noremap t :tabclose <CR>
+"noremap m :q! <CR>
+"noremap w :w <CR>
+noremap h :tabnew<CR>
" Tab navigation
" See http://vim.wikia.com/wiki/Alternative_tab_navigation
" http://comments.gmane.org/gmane.os.cygwin.xfree/16419
-nmap <ESC>[5^ <C-PageUp>
-nmap <ESC>[6^ <C-PageDown>
+nnoremap <ESC>[5^ <C-PageUp>
+nnoremap <ESC>[6^ <C-PageDown>
nnoremap <C-PageDown> :tabn<CR>
nnoremap <C-PageUp> :tabp<CR>
-nmap 1 1gt
-nmap 2 2gt
-nmap 3 3gt
-nmap 4 4gt
-nmap 5 5gt
-nmap 6 6gt
-nmap 7 7gt
-nmap 8 8gt
-nmap 9 9gt
-nmap 0 10gt
+nnoremap 1 1gt
+nnoremap 2 2gt
+nnoremap 3 3gt
+nnoremap 4 4gt
+nnoremap 5 5gt
+nnoremap 6 6gt
+nnoremap 7 7gt
+nnoremap 8 8gt
+nnoremap 9 9gt
+nnoremap 0 10gt
" Buffer navigation: Alt-{Up,Down}
-map Od :bprevious<CR>
-map Oc :bnext<CR>
+noremap Od :bprevious<CR>
+noremap Oc :bnext<CR>
" Window navigation
-"map <C-Left> <C-w><Left>
-"map <C-Right> <C-w><Right>
-"map <C-Down> <C-w><Down>
-"map <C-Up> <C-w><Up>
-"imap <C-Left> <ESC><C-w><Left>
-"imap <C-Right> <ESC><C-w><Right>
-"imap <C-Down> <ESC><C-w><Down>
-"imap <C-Up> <ESC><C-w><Up>
-"map <Left> <C-w><Left>
-"map <Right> <C-w><Right>
-"map <Down> <C-w><Down>
-"map <Up> <C-w><Up>
-"imap <Left> <ESC><C-w><Left>
-"imap <Right> <ESC><C-w><Right>
-"imap <Down> <ESC><C-w><Down>
-"imap <Up> <ESC><C-w><Up>
-nmap <ESC><Left> <C-w><Left>
-nmap <ESC><Right> <C-w><Right>
-nmap <ESC><Down> <C-w><Down>
-nmap <ESC><Up> <C-w><Up>
-imap <ESC><Left> <ESC><C-w><Left>
-imap <ESC><Right> <ESC><C-w><Right>
-imap <ESC><Down> <ESC><C-w><Down>
-imap <ESC><Up> <ESC><C-w><Up>
+"noremap <C-Left> <C-w><Left>
+"noremap <C-Right> <C-w><Right>
+"noremap <C-Down> <C-w><Down>
+"noremap <C-Up> <C-w><Up>
+"inoremap <C-Left> <ESC><C-w><Left>
+"inoremap <C-Right> <ESC><C-w><Right>
+"inoremap <C-Down> <ESC><C-w><Down>
+"inoremap <C-Up> <ESC><C-w><Up>
+"noremap <Left> <C-w><Left>
+"noremap <Right> <C-w><Right>
+"noremap <Down> <C-w><Down>
+"noremap <Up> <C-w><Up>
+"inoremap <Left> <ESC><C-w><Left>
+"inoremap <Right> <ESC><C-w><Right>
+"inoremap <Down> <ESC><C-w><Down>
+"inoremap <Up> <ESC><C-w><Up>
+nnoremap <ESC><Left> <C-w><Left>
+nnoremap <ESC><Right> <C-w><Right>
+nnoremap <ESC><Down> <C-w><Down>
+nnoremap <ESC><Up> <C-w><Up>
+inoremap <ESC><Left> <ESC><C-w><Left>
+inoremap <ESC><Right> <ESC><C-w><Right>
+inoremap <ESC><Down> <ESC><C-w><Down>
+inoremap <ESC><Up> <ESC><C-w><Up>
" NERDTree section
" Thanks to http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc
+let NERDTreeMinimalUI=1
+
augroup nerdtree
autocmd!
" Open NERDTree when vim starts
@@ -334,8 +340,8 @@ command -nargs=0 OpenNERDTree :call OpenNERDTree()
" See http://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv
"imap <C-v> <C-r><C-o>+
"vmap <C-v> c<ESC>"+p
-vmap <C-c> "+yi
-vmap <C-x> "+c
+vnoremap <C-c> "+yi
+vnoremap <C-x> "+c
" Workaround for mail editing. There must be a plugin enabling autoindent in
" mail composition, which is annoying.
@@ -400,7 +406,6 @@ let g:session_autosave_silent=1
let g:session_autosave='yes'
let g:session_autoload='no'
let g:session_directory='~/.local/share/vim/sessions'
-let NERDTreeMinimalUI=1
" Autosave
" See https://github.com/vim-scripts/vim-auto-save