Skip to content

Instantly share code, notes, and snippets.

@dppeak
Created December 6, 2018 21:05
Show Gist options
  • Save dppeak/9ed2af5a33caa43baf74522b1935399f to your computer and use it in GitHub Desktop.
Save dppeak/9ed2af5a33caa43baf74522b1935399f to your computer and use it in GitHub Desktop.
" Include user's local vim-plug config
if filereadable(expand("~/.vim/vim-plugrc"))
source ~/.vim/vim-plugrc
endif
" Use Vim defaults (much better!)
set nocompatible
" Enable 256 Support
set t_Co=256
set termguicolors
let base16colorspace=256 " Access colors present in 256 colorspace
set nonumber
set ruler " show the cursor position all the time
syntax on
" Set encoding
set encoding=utf-8
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
" Whitespace stuff
"set nowrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set nolist listchars=tab:»·,trail:·,eol
"set list listchars=tab:\ \ ,trail:·
"set list listchars=tab:»·,trail:·,eol:¶
" Searching
set hlsearch!
set incsearch
set ignorecase
set smartcase
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
" Status bar
set laststatus=2 " Always display the statusline in all windows
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
" Without setting this, ZoomWin restores windows in a way that causes
" equalalways behavior to be triggered the next time CommandT is used.
" This is likely a bludgeon to solve some other issue, but it works
set noequalalways
" NERDTree configuration
let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
map <Leader>n :NERDTreeToggle<CR>
" Command-T configuration
let g:CommandTMaxHeight=20
" ZoomWin configuration
map <Leader><Leader> :ZoomWin<CR>
" CTags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
map <C-\> :tnext<CR>
" Only do this part when compiled with support for autocommands
if has("autocmd")
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif
" In text files, always limit the width of text to 78 characters
function s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=78
endfunction
function s:setupMarkup()
call s:setupWrapping()
map <buffer> <Leader>p :Hammer<CR>
endfunction
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" md, markdown, and mk are markdown and define buffer-local preview
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
au BufRead,BufNewFile *.txt call s:setupWrapping()
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" load the plugin and indent settings for the detected filetype
filetype plugin indent off
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Opens a tab edit command with the path of the currently edited file filled in
" Normal mode: <Leader>t
map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
" Inserts the path of the currently edited file into a command
" Command mode: Ctrl+P
cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
" Enable syntastic syntax checking
let g:syntastic_enable_signs=1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" loading the DevIcons plugin
let g:webdevicons_enable = 1
let g:WebDevIconsOS = 'Darwin'
" Activate the Mustache Abbreviations plugin
let g:mustache_abbreviations = 1
" gist-vim defaults
if has("mac")
let g:gist_clip_command = 'pbcopy'
elseif has("unix")
let g:gist_clip_command = 'xclip -selection clipboard'
endif
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
" Use modeline overrides
set modeline
set modelines=10
" Default color scheme
color desert
"set background=dark
" Directories for swp files
set backupdir=~/.vim/backup
set directory=~/.vim/backup
" Turn off jslint errors by default
let g:JSLintHighlightErrorLine = 0
" MacVIM shift+arrow-keys behavior (required in .vimrc)
let macvim_hig_shift_movement = 1
" % to bounce from do to end etc.
runtime! macros/matchit.vim
" Show (partial) command in the status line
set showcmd
nnoremap <F12> :set hlsearch!<CR>
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
if has("gui_running")
let s:uname = system("uname")
if s:uname == "Darwin\n"
set guifont=Menlo\ for\ Powerline:h12
set noshowmode
" set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12
endif
endif
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
let g:Powerline_symbols = 'fancy'
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment