Created
February 6, 2017 16:44
-
-
Save martinwolf/f57b5c8638fc468b561a6d7d8e49c0cd to your computer and use it in GitHub Desktop.
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
" .VIMRC | |
set nocompatible " This should be the first line. It sets vim to not be backwards compatible with vi. | |
set encoding=utf-8 " Encoding | |
" VUNDLE PLUGINS | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'cakebaker/scss-syntax.vim' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'othree/html5.vim' | |
Plugin 'captbaritone/better-indent-support-for-php-with-html' | |
Plugin 'christoomey/vim-tmux-navigator' | |
Plugin 'tpope/vim-surround' | |
Plugin 'jeetsukumaran/vim-buffergator' | |
Plugin 'tpope/vim-vinegar' | |
Plugin 'ap/vim-css-color' | |
Plugin 'rking/ag.vim' | |
Plugin 'kchmck/vim-coffee-script' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'mustache/vim-mustache-handlebars' | |
Plugin 'editorconfig/editorconfig-vim' | |
Plugin 'trevordmiller/nova-vim' | |
call vundle#end() | |
" VISUALS | |
syntax enable " Enable Syntax Highlighting | |
set t_Co=256 " 256 colours, please | |
" set background=dark " Dark background | |
" colorscheme base16-ocean " Dark Color Scheme | |
" colorscheme base16-bright " Light Color Scheme | |
colorscheme nova | |
hi normal ctermbg=NONE " Stuff for iTerm" | |
" @mrmrs vim styles | |
" hi LineNr ctermfg=gray ctermbg=NONE | |
" hi htmlTagName ctermfg=black ctermbg=NONE | |
" Tabs, indentation and lines | |
filetype plugin indent on | |
" 4 spaces please | |
set expandtab | |
set shiftwidth=4 | |
set tabstop=4 | |
set softtabstop=4 | |
" Round indent to nearest multiple of 4 | |
set shiftround | |
set wrap " Word wrapping | |
" set textwidth=90 | |
" set formatoptions=cqt | |
" set formatoptions=qrn1 " Make line wrap create new vim line | |
set smartindent | |
set breakindent " Make word wrapping behave like it does in every other sane text editor | |
set autoindent | |
set wrap linebreak nolist | |
" set linespace=4 | |
" Show status line | |
set laststatus=2 | |
" Show what mode you’re currently in | |
set showmode | |
" Show what commands you’re typing | |
set showcmd | |
" visual autocomplete for command menu | |
set wildmenu | |
" redraw only when we need to | |
set lazyredraw | |
" Allow modelines | |
set showmatch | |
" highlight matching [{()}] | |
set modeline | |
" Show current line and column position in file | |
set ruler | |
" Show file title in terminal tab | |
set title | |
" Set relative line numbers... | |
set relativenumber | |
" ...but absolute numbers on the current line | |
set number | |
" Limit line-length to 80 columns by highlighting col 81 | |
set colorcolumn=81 | |
" Highlight current line | |
set cursorline | |
" Don’t keep results highlighted after searching... | |
set nohlsearch | |
" ...just highlight as we type | |
set incsearch | |
" Ignore case when searching... | |
set ignorecase | |
" ...except if we input a capital letter | |
set smartcase | |
" That bell is the worst sound. Shut it the fuck off. | |
set visualbell | |
" Set relevant filetypes | |
au BufRead,BufNewFile *.md set filetype=markdown | |
au BufRead,BufNewFile *.lens set filetype=html | |
" INTERACTIONS | |
" Start scrolling slightly before the cursor reaches an edge | |
set scrolloff=3 | |
set sidescrolloff=5 | |
" Scroll sideways a character at a time, rather than a screen at a time | |
set sidescroll=1 | |
" Allow motions and back-spacing over line-endings etc | |
set backspace=indent,eol,start | |
set whichwrap=h,l,b,<,>,~,[,] | |
" Underscores denote words | |
set iskeyword-=_ | |
set autoread " Make Vim automatically open changed files (e.g. changed after a Git commit) | |
" set iskeyword+=- "Makes foo-bar considered one word | |
" KEY MAPPINGS | |
" Set , as the leader key | |
let mapleader = "\<Space>" | |
" makes j and k work the way you expect instead of working in some archaic | |
" “movement by file line instead of screen line” fashion. | |
nnoremap j gj | |
nnoremap k gk | |
" jj to throw you into normal mode from insert mode | |
inoremap jj <esc> | |
" jk to throw you into normal mode from insert mode | |
inoremap jk <esc> | |
" New line below, staying in current line with Enter when in normal mode | |
nmap <CR> o<ESC>k | |
" Disable arrow keys (hardcore) | |
map <up> <nop> | |
imap <up> <nop> | |
map <down> <nop> | |
imap <down> <nop> | |
map <left> <nop> | |
imap <left> <nop> | |
map <right> <nop> | |
imap <right> <nop> | |
" Easier split navigations, use ctrl+j instead of ctrl+w j, etc. | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Open new split panes to right and bottom | |
set splitbelow | |
set splitright | |
" Open the file explorer | |
nnoremap <leader>n :Explore<cr> | |
nnoremap <C-N> :Explore<cr> | |
" Toggle paste | |
set pastetoggle=<F2> | |
" Source .vimrc | |
nmap <silent> <leader>sv :so $MYVIMRC<CR> | |
" Make `Y` behave like `C` and `D` | |
map Y y$ | |
" SOME ADDITIONAL STUFF | |
" Highlight redundant whitespaces and tabs. Only shows trailing whitespace :) | |
highlight RedundantSpaces ctermbg=red | |
match RedundantSpaces /\s\+$/ | |
" This function trims trailing whitespace on save | |
function! TrimWhiteSpace() | |
%s/\s\+$//e | |
endfunction | |
autocmd FileType html,php,vimrc,scss,css,js autocmd BufWritePre <buffer> :call TrimWhiteSpace() | |
" Paste space + register | |
nmap <leader>m i<space><esc>p | |
nmap <leader>M i<space><esc>P | |
" vp doesn't replace paste buffer | |
function! RestoreRegister() | |
let @" = s:restore_reg | |
return '' | |
endfunction | |
function! s:Repl() | |
let s:restore_reg = @" | |
return "p@=RestoreRegister()\<cr>" | |
endfunction | |
vmap <silent> <expr> p <sid>Repl() | |
" EMMET SETTINGS | |
" let g:user_emmet_install_global = 0 | |
" autocmd FileType html,css,scss,php,hbs EmmetInstall | |
" let g:user_emmet_leader_key='<C-Z>' | |
" CTRL+P SETTINGS | |
"set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*,*/css-temp/*,*/js-temp/*,*/_site/*,*/wp-admin/*,*/wp-content/plugins/*,*/wp-includes/* | |
" Setup some default ignores/Doen't work when using user_command with ag.vim | |
"let g:ctrlp_custom_ignore = { | |
" \ 'dir': '\v[\/](\.(git|hg|svn)|\dist)$', | |
" \ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$', | |
"\} | |
" Use the nearest .git directory as the cwd | |
" This makes a lot of sense if you are working on a project that is in version | |
" control. It also supports works with .svn, .hg, .bzr. | |
let g:ctrlp_working_path_mode = 'r' | |
" lets us change the working directory during a Vim session and make CtrlP | |
" respect that change. | |
" let g:ctrlp_working_path_mode = 0 | |
" Use a leader instead of the actual named binding | |
nmap <leader>p :CtrlP<cr> | |
" Easy bindings for its various modes | |
nmap <leader>bb :CtrlPBuffer<cr> | |
nmap <leader>bm :CtrlPMixed<cr> | |
nmap <leader>bs :CtrlPMRU<cr> | |
" Clear File Cache | |
nmap <leader>cc :CtrlPClearCache<cr> | |
" Use ag.vim/The Silver Searcher for searching | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
" VIM-AIRLINE SETTINGS | |
let g:airline_theme='base16' | |
" Automatically displays all buffers when there's only one tab open. | |
" let g:airline#extensions#tabline#enabled = 1 | |
" Disable Bufferline | |
let g:airline#extensions#bufferline#enabled = 0 | |
" Show just the filename | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
" Remove powerline separator symbols | |
let g:airline_powerline_fonts = 0 | |
let g:airline_left_sep = '' | |
let g:airline_right_sep = '' | |
" Check indentation differences between spaces/tabs within a line, overlong | |
" lines and trailing whitespaces | |
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long' ] | |
" BUFFER SETTINGS | |
" Use the top side of the screen, 100% width | |
let g:buffergator_viewport_split_policy = 'T' | |
" I want my own keymappings... | |
let g:buffergator_suppress_keymaps = 1 | |
" Looper buffers | |
let g:buffergator_mru_cycle_loop = 1 | |
" Go to the previous buffer open | |
nmap <leader>kk :BuffergatorMruCyclePrev<cr> | |
" Go to the next buffer open | |
nmap <leader>jj :BuffergatorMruCycleNext<cr> | |
" View the entire list of buffers open | |
nmap <leader>bl :BuffergatorOpen<cr> | |
" To open a new empty buffer | |
" This replaces :tabnew which I used to bind to this mapping | |
nmap <leader>T :enew<cr> | |
" Close the current buffer and move to the previous one | |
" This replicates the idea of closing a tab | |
nmap <leader>bc :bp <BAR> bd #<cr> | |
" CLose all buffers | |
nmap <leader>bq :%bd<cr> | |
" open ag.vim | |
nnoremap <leader>a :Ag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment