This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Exit Vim if Backspace key at beginning of unmodified buffer (top left) | |
| " Very usefull if you use a terminal file explorer like Ranger | |
| " https://github.com/ranger/ranger | |
| " you can just got into and out of files with Enter and Backspace keys. | |
| " Obviously will notify if buffer is modified and unsaved. | |
| function! ExitAtBufferStart() | |
| if line('.') == 1 && col('.') == 1 | |
| quit | |
| else | |
| execute "normal! \<BS>" | |
| endif | |
| endfunction | |
| nnoremap <silent> <BS> :call ExitAtBufferStart()<CR> |