Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created July 5, 2018 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadowhand/baee516a43f84253d1c13d034032f03f to your computer and use it in GitHub Desktop.
Save shadowhand/baee516a43f84253d1c13d034032f03f to your computer and use it in GitHub Desktop.
" force utf-8 mode
scriptencoding utf-8
" i got 99 problems, but utf-8...
set encoding=utf-8
" https://github.com/junegunn/vim-plug
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'bogado/file-line'
Plug 'chriskempson/base16-vim'
Plug 'editorconfig/editorconfig-vim', { 'do': 'brew install editorconfig' }
Plug 'elzr/vim-json', { 'for': 'json' }
Plug 'ervandew/supertab'
Plug 'groenewege/vim-less', { 'for': 'less' }
Plug 'hashivim/vim-vagrant'
Plug 'henrik/vim-indexed-search'
Plug 'JamshedVesuna/vim-markdown-preview', { 'for': 'markdown' }
Plug 'jiangmiao/auto-pairs'
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/vim-plug'
Plug 'kylef/apiblueprint.vim'
Plug 'mattn/emmet-vim'
Plug 'othree/yajs.vim', { 'for': 'javascript' }
Plug 'pearofducks/ansible-vim'
Plug 'phpvim/phpcd.vim', { 'for': 'php' , 'do': 'composer update' }
Plug 'rodjek/vim-puppet'
Plug 'rschmukler/pangloss-vim-indent'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'wincent/command-t', { 'do': 'cd ruby/command-t && ruby extconf.rb && make && make install' }
Plug 'w0rp/ale'
call plug#end()
" make love to my eyes
colorscheme base16-default-dark
" can haz highlights
syntax enable
" use 4 spaces for tabs
set tabstop=4 shiftwidth=4 softtabstop=4 expandtab
" always show tabs
set showtabline=2
" always show status line
set laststatus=2
" allow backspace to be used in indent
set backspace+=indent,eol,start
" show current line number
set number
" show relative line numbers for everything else
set relativenumber
" show current line/column
set ruler
" disable enable spell checker
set nospell
" show balloon when available
"set ballooneval
" show whitespace
set list listchars=tab:\▸\ ,trail:·,eol:¬
" automatically indent new lines
set autoindent
set smartindent
" automatically continue comments
set formatoptions+=r
" softwrap and keep words intact
set wrap linebreak
" searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" do not search git directory
set wildignore+=*/.git/*
" do not search node modules
set wildignore+=*/node_modules/*
" do not search build directories
set wildignore+=*/build/*
"folding settings
set foldmethod=syntax "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
" Enable javascript syntax with yajs
autocmd BufRead,BufNewFile *.js set filetype=javascript
" Enable mustache syntax
autocmd BufRead,BufNewFile *.mustache set filetype=mustache
" Enable phpcd omnicomplete
autocmd FileType php setlocal omnifunc=phpcd#CompletePHP
" Change tab size for vagrant/puppet/yaml files
autocmd BufRead,BufNewFile Vagrantfile setlocal sw=2 ts=2 expandtab
autocmd BufRead,BufNewFile *.pp setlocal sw=2 ts=2 expandtab
autocmd BufRead,BufNewFile *.yaml setlocal sw=2 ts=2 expandtab
autocmd BufRead,BufNewFile *.yml setlocal sw=2 ts=2 expandtab
autocmd BufRead,BufNewFile *.feature setlocal sw=2 ts=2 expandtab
" Enable powerline fonts
let g:airline_powerline_fonts = 1
" Enable base16 airline them
let g:airline_theme='base16_default'
" Enable conf and php syntax in .j2 files
let g:ansible_extra_syntaxes = "apache.vim conf.vim php.vim"
" Enable supertab for omnicomplete
let g:SuperTabDefaultCompletionType = "<C-X><C-O>"
" use grip for Markdown previews
let vim_markdown_preview_github=1
" Use Google Chrome for Markdown previews
let vim_markdown_preview_browser="Google Chrome"
" Use Ctrl+m for Markdown Preview
let vim_markdown_preview_hotkey="<C-m>"
" use binary editorconfig
let g:EditorConfig_core_mode="external_command"
" enable all .md files to be Markdown
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
" enable ALE + Airline reporting
let g:airline#extensions#ale#enabled = 1
" enable ALE gutter at all times
let g:ale_sign_column_always = 1
" only run ALE on save
let g:ale_lint_on_text_changed = 'never'
" set the default style for PHPCS
let g:ale_php_phpcs_standard = "PSR2"
" disable JSON quote hiding
let g:vim_json_syntax_conceal = 0
" use W for a sudo write (and write quit)
command! W :execute ':silent w !sudo tee % > /dev/null' | :edit!
command! Wq :execute ':W' | :q
" copy the current filename (OSX)
command! -nargs=0 CopyFilePath exe "!echo '%' | pbcopy"
" -----------------------------------------------------------------------------
" NOTE: To use the following two commands, first install git-blameurl!
" https://github.com/shadowhand/git-blameurl
" -----------------------------------------------------------------------------
" Copy the current blame url for this file/line
command! -nargs=0 CopyBlameURL exe "!echo $(git blame-url %)\\\#L" . line(".") . " | pbcopy"
" Open the blame url for this file/line
command! -nargs=0 OpenBlameURL exe "!open $(git blame-url %)\\\#L" . line(".")
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" tab between buffers
map <C-Tab> :bnext<cr>
map <C-S-Tab> :bprevious<cr>
" use H and L to move between tabs
map <C-h> gT
map <C-l> gt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment