Created
March 23, 2018 22:14
-
-
Save Fingel/9fdbe9b2d271421f894d06c8418264e6 to your computer and use it in GitHub Desktop.
SImple But Usable Vim Config
This file contains 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
" Spaces and indent | |
set expandtab " tabs are spaces | |
set shiftwidth=4 " size of indents in spaces | |
set softtabstop=4 " simulate tabs with this many spaces | |
" FileType specific tab overrides | |
filetype plugin indent on " Enable filetype detection and <filetype>.vim loading | |
autocmd FileType html setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType vue setlocal shiftwidth=2 tabstop=2 | |
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 | |
" Line numbers and mouse | |
set number " enable line numbers | |
set mouse=a " enable mouse in auto mode | |
" Searching | |
set incsearch " don't wait for the enter key to start searching | |
set hlsearch " highlight search results | |
" Syntax highlighting and themes | |
syntax enable " turn on syntax highlighting | |
colorscheme slate " use the slate theme | |
" Map gl to the previously used tab | |
let g:lasttab = 1 | |
nmap gl :exe "tabn ".g:lasttab<CR> | |
au TabLeave * let g:lasttab = tabpagenr() | |
" Strip trailing whitespace | |
fun! TrimWhitespace() | |
let l:save = winsaveview() | |
%s/\s\+$//e | |
call winrestview(l:save) | |
endfun | |
autocmd BufWritePre * :call TrimWhitespace() " Call TrimWhitespace on save | |
" Misc | |
set wildmenu " show tab completions for commands inline | |
" Files to ignore for various auto completion commands | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,__pycache__,node_modules | |
" Remap the dd shortcut to not override the yank register | |
nnoremap d "_d | |
vnoremap d "_d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment