Created
March 26, 2016 12:59
-
-
Save neulaender/b399918e0493ea808367 to your computer and use it in GitHub Desktop.
Working vanilla/pluginless vim dotfile.
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
" Use the bash instead of my standard shell as most scripts are based on it | |
set shell=/bin/bash | |
set t_Co=256 " 256 color mode | |
set encoding=utf-8 " always use utf-8 | |
set mouse=a " enable mouse usage | |
set nocompatible " should be auto-on, but to be sure... | |
set number " Numbering on left side. | |
set relativenumber " Sets numbers relative to the current line | |
au InsertEnter * :set nu " Enter absolute number mode in insert mode | |
au InsertLeave * :set rnu " relative ... in normal mode | |
set laststatus=2 " Always show info line | |
" My favorite colorschemes - with vundle/neobundle a lot more are usable | |
colors desert " almost always existent | |
" only show tabs with >~ and trailing spaces as · | |
highlight ColorColumn ctermbg=darkgreen | |
call matchadd('ColorColumn', '\%81v',100) | |
set listchars=tab:▸-,trail:· | |
set list " Shows characters | |
set hlsearch " hlsearches | |
syntax on " Enable Syntax-Highlighting | |
" Highlight current line via bold-fonts and dark grey background | |
set cursorline | |
highlight CursorLine term=bold cterm=bold ctermbg=232 | |
" Wildmenu - Improved tabbing through : commands | |
set wildmenu | |
set wildmode=longest:full,full | |
" Indentation | |
set autoindent " Autoindents | |
set shiftwidth=4 " How many columns to indent with >> and <<. | |
set tabstop=4 " Show tabs as 4 spaces | |
set expandtab " Replaces tab-press with 4 spaces | |
set si " Enables smart indentation | |
set scrolloff=4 " always have 4 lines above/below the cursor | |
" Little helpers | |
" let mapleader = "," " use , as the leader key. Standard: \ | |
" Map Y such that it behaves like other capitals | |
map Y 0y$ | |
" Map Q to repeat last recorded macro | |
map Q @@ | |
" Improve up/down movement with wrapped lines | |
nnoremap j gj | |
nnoremap k gk | |
" Set w!! to force saving files as root | |
cmap w!! %sudo tee > /dev/null % | |
" Press leader/ for clearing search highlights | |
noremap <silent><leader>/ :nohls<CR> | |
" Help standardized | |
noremap <F1> <ESC> | |
" Use arrow keys for buffer | |
noremap <left> :bp<CR> | |
noremap <right> :bn<CR> | |
" Use +/- for incrementing and decrementing numbers | |
nnoremap + <C-a> | |
nnoremap - <C-x> | |
" Keep the search pattern at the center of the screen: | |
nnoremap <silent> n nzz | |
nnoremap <silent> N Nzz | |
nnoremap <silent> * *zz | |
nnoremap <silent> # #zz | |
nnoremap <silent> g* g*zz | |
nnoremap <silent> g# g#zz | |
" Improve vim splits - should speak for itself | |
nnoremap <silent> <leader>+ :exe "resize " . (winheight(0) * 3/2)<CR> | |
nnoremap <silent> <leader>- :exe "resize " . (winheight(0) * 2/3)<CR> | |
nnoremap <silent> <leader><leader>+ :exe "vertical resize " . (winwidth(0) * 3/2)<CR> | |
nnoremap <silent> <leader><leader>- :exe "vertical resize " . (winwidth(0) * 2/3)<CR> | |
" Easier split navigation | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
" Tab management - Firefoxlike behaviour (replace C-w as close) | |
" nnoremap <C-t> :tabnew<CR> | |
" inoremap <C-t> <ESC>:tabnew<CR> | |
" nnoremap <C-w> :tabclose<CR> | |
" nnoremap <C-S-h> gT<CR> | |
" nnoremap <C-S-l> gt<CR> | |
" Reapplies visual after indentation (good for blocks) | |
vnoremap < <gv | |
vnoremap > >gv | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment