Skip to content

Instantly share code, notes, and snippets.

@simme
Created August 23, 2016 08:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simme/85193ce3fb178c87fbeaf1242c0b01bc to your computer and use it in GitHub Desktop.
Save simme/85193ce3fb178c87fbeaf1242c0b01bc to your computer and use it in GitHub Desktop.
" Use Vim settings
set nocompatible
set encoding=utf-8
" Use , as leader
let mapleader=","
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Git integration.
Plugin 'tpope/vim-fugitive'
" Show git status in line-number gutter.
Plugin 'airblade/vim-gitgutter'
" silver searcher plugin, instead of grep.
Plugin 'rking/ag.vim'
" Plugin for aligning stuff.
Plugin 'tsaleh/vim-align'
" Nerdtree!
Plugin 'scrooloose/nerdtree'
" Surround selected text with punctuation:
Plugin 'tpope/vim-surround'
" For jshint.
Plugin 'scrooloose/syntastic'
" Smart input of ([ etc.
Plugin 'kana/vim-smartinput'
" Open current buffer in Marked.app.
Plugin 'itspriddle/vim-marked'
" Better navigation with tmux.
Plugin 'christoomey/vim-tmux-navigator'
" Editor config
Bundle 'editorconfig/editorconfig-vim'
" Dash integration
Plugin 'rizzatti/dash.vim'
" Ctrl-p
Plugin 'kien/ctrlp.vim'
" Color theme.
Plugin 'altercation/vim-colors-solarized'
" Syntaxes and platforms
Bundle 'jelera/vim-javascript-syntax'
Bundle 'moll/vim-node'
Bundle 'mustache/vim-mustache-handlebars'
Bundle 'digitaltoad/vim-jade'
Bundle 'StanAngeloff/php.vim'
Bundle 'evidens/vim-twig'
call vundle#end() " required
filetype plugin indent on " required
" -------------------------------------------------------------------------
" General configuration
set number " Enable line numbers
set backspace=indent,eol,start " Allow backspace in insert mode
set history=1000 " Lots of history
set showcmd " Show commands as they are written
set showmode " Show current mode
set gcr=a:blinkon0 " Disable blinking cursor
set visualbell " No sounds
set autoread " Reload files changed outside of Vim
set modelines=0 " Turn off modelines
set encoding=utf-8 " UTF8 all the things
set ttyfast " Set fast TTY
set laststatus=2 " Always show status line
set ch=2 " Command line height 2
set formatoptions=qrn1 " Autoformat options
set colorcolumn=80 " Show 80 column mark
set hidden " Enable background buffers
syntax enable " Enable syntax coloring
set noshowmode " Hide mode, shown in Powerline
set background=light
colorscheme Solarized
" Turn off swap files
set noswapfile
set nobackup
set nowb
" Persistent undo
set undodir=~/.vim/backups
set undofile
" Indentation settings
set autoindent " Automatic indentation
set smartindent
set smarttab
set shiftwidth=2 " 2 spaces
set softtabstop=2
set tabstop=2
set expandtab " Spaces for tabs
" filetype plugin on
" filetype indent on
" Display end of lines and no breaking spaces
set list
set listchars=tab:··,eol:¬,nbsp:†
" Fold settings
set foldmethod=indent " Fold based on indent
set nofoldenable " Don't fold by default
" Completion
set wildmode=list:longest
set wildmenu " Enable autocomplete menu
set wildignore=*.o,*.obj,*- " Don't complete from these files
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=*.png,*.jpg*,*.gif
" Ignore node_modules in CommandT
let g:CommandTWildIgnore=&wildignore . ",**/node_modules/*"
" Scrolling
set scrolloff=8 " 8 lines of scroll margin
set sidescrolloff=15 " 15 lines of horizontal margin
set sidescroll=1
" Searching
set ignorecase " Ignore case by default
set smartcase " Smart case sensitivity
set gdefault " Global search by default
set incsearch " Jump to matches while searching
set showmatch " Show matching braces etc
set hlsearch " Highlight matches
" Powerline
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
" -------------------------------------------------------------------------
" Aliases
" Open NERDTree
map <leader>n :NERDTreeToggle<CR>
" Clear highlighting
nnoremap <leader><space> :noh<CR>
" Trim trailing whitespace
nnoremap <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
" Ignore arrow keys, we are hard core
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" Fix escape missess...
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Fix j and k to work as expected with wrapping lines
nnoremap j gj
nnoremap k gk
" --------------------------------------------------------------------------
" Syntax specific
au FileType javascript call JavaScriptFold()
let g:syntastic_debug = 0
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_javascript_checkers=['standard']
let g:syntastic_javascript_standard_exec = 'semistandard'
" Custom syntastic settings:
" https://blog.differentpla.net/post/21/vim-syntastic-jshintrc
"function s:find_jshintrc(dir)
" let l:found = globpath(a:dir, '.jshintrc')
" if filereadable(l:found)
" return l:found
" endif
"
" let l:parent = fnamemodify(a:dir, ':h')
" if l:parent != a:dir
" return s:find_jshintrc(l:parent)
" endif
"
" return $HOME . "/.jshintrc"
"endfunction
"
"function UpdateJsHintConf()
" let l:dir = expand('%:p:h')
" let l:jshintrc = s:find_jshintrc(l:dir)
" "let g:syntastic_javascript_jshint_conf = l:jshintrc
" let g:syntastic_javascript_jshint_args = "--config " . l:jshintrc
"endfunction
" au BufEnter * call UpdateJsHintConf()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment