Skip to content

Instantly share code, notes, and snippets.

@burningTyger
Created October 30, 2015 08:06
Show Gist options
  • Select an option

  • Save burningTyger/3f429c28fcfe786de0cd to your computer and use it in GitHub Desktop.

Select an option

Save burningTyger/3f429c28fcfe786de0cd to your computer and use it in GitHub Desktop.
call plug#begin('~/.vim/plugged')
Plug 'kien/ctrlp.vim'
Plug 'ervandew/supertab'
Plug 'scrooloose/syntastic'
Plug 'bronson/vim-trailing-whitespace'
Plug 'bling/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'slim-template/vim-slim'
Plug 'pangloss/vim-javascript'
Plug 'kchmck/vim-coffee-script'
Plug 'elzr/vim-json'
Plug 'tpope/vim-git'
Plug 'groenewege/vim-less'
Plug 'tpope/vim-markdown'
Plug 'sunaku/vim-ruby-minitest'
Plug 'depuracao/vim-rdoc'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-haml'
Plug 'vim-ruby/vim-ruby'
Plug 'cakebaker/scss-syntax.vim'
Plug 'endel/vim-github-colorscheme'
Plug 'acarapetis/vim-colors-github'
Plug 'chriskempson/vim-tomorrow-theme'
Plug 'chriskempson/base16-vim'
Plug 'ap/vim-css-color'
call plug#end()
" airline
let g:airline_powerline_fonts = 1
" vim-slim
syntax enable
filetype plugin indent on
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_signs=1
let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:syntastic_auto_loc_list=2
" ctrlp
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\.pyc$\|\.pyo$\|\.rbc$|\.rbo$\|\.class$\|\.o$\|\~$\',
\ }
" weiteres
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,Procfile,Guardfile,config.ru,*.rake} set ft=ruby
au FileType make setlocal noexpandtab
au FileType markdown setlocal wrap linebreak textwidth=72 nolist
au FileType python setlocal tabstop=4 shiftwidth=4
" Remember last location in file, but not for commit messages.
" see :help last-position-jump
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
" key mappings
let mapleader = ","
" Toggle paste mode
nmap <silent> <F4> :set invpaste<CR>:set paste?<CR>
imap <silent> <F4> <ESC>:set invpaste<CR>:set paste?<CR>
" format the entire file
nnoremap <leader>fef :normal! gg=G``<CR>
" upper/lower word
nmap <leader>u mQviwU`Q
nmap <leader>l mQviwu`Q
" upper/lower first char of word
nmap <leader>U mQgewvU`Q
nmap <leader>L mQgewvu`Q
" cd to the directory containing the file in the buffer
nmap <silent> <leader>cd :lcd %:h<CR>
" Create the directory containing the file in the buffer
nmap <silent> <leader>md :!mkdir -p %:p:h<CR>
" Some helpers to edit mode
" http://vimcasts.org/e/14
nmap <leader>ew :e <C-R>=expand('%:h').'/'<cr>
nmap <leader>es :sp <C-R>=expand('%:h').'/'<cr>
nmap <leader>ev :vsp <C-R>=expand('%:h').'/'<cr>
nmap <leader>et :tabe <C-R>=expand('%:h').'/'<cr>
" Swap two words
nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
" Underline the current line with '='
nmap <silent> <leader>ul :t.<CR>Vr=
" set text wrapping toggles
nmap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
" find merge conflict markers
nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" Map the arrow keys to be based on display lines, not physical lines
map <Down> gj
map <Up> gk
" Toggle hlsearch with <leader>hs
nmap <leader>hs :set hlsearch! hlsearch?<CR>
" Adjust viewports to the same size
map <Leader>= <C-w>=
" Map Control-# to switch tabs
map <C-0> 0gt
imap <C-0> <Esc>0gt
map <C-1> 1gt
imap <C-1> <Esc>1gt
map <C-2> 2gt
imap <C-2> <Esc>2gt
map <C-3> 3gt
imap <C-3> <Esc>3gt
map <C-4> 4gt
imap <C-4> <Esc>4gt
map <C-5> 5gt
imap <C-5> <Esc>5gt
map <C-6> 6gt
imap <C-6> <Esc>6gt
map <C-7> 7gt
imap <C-7> <Esc>7gt
map <C-8> 8gt
imap <C-8> <Esc>8gt
map <C-9> 9gt
imap <C-9> <Esc>9gt
""
"" Basic Setup
""
set nocompatible " Use vim, no vi defaults
set number " Show line numbers
set ruler " Show line and column number
syntax enable " Turn on syntax highlighting allowing local overrides
set encoding=utf-8 " Set default encoding to UTF-8
""
"" Whitespace
""
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
" List chars
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the left of the screen
""
"" 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
""
"" Backup and swap files
""
set backupdir^=~/.vim/_backup// " where to put backup files.
set directory^=~/.vim/_temp// " where to put swap files.
"cursor shape
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
:set colorcolumn=80
:set hidden
"set statusline=%f\ %m\ %r
:runtime macros/matchit.vim
" remap pane moves
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
" start scrolling before cursor reaches border
set scrolloff=6
" unmark hilighted search results
noremap <Leader>m :nohlsearch<CR>
map <Leader>p <C-^> " Go to previous file
imap uu _
imap hh =>
imap aa @
imap öö {
imap ää }
imap ßß [
imap üü ]
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ai "Auto indent
set si "Smart indent
" map jj to Escape
imap jj <Esc> " Professor VIM says '87% of users prefer jj over esc', jj abrams disagrees
" Insert New Line *************************************************************
map <S-Enter> O<ESC> " awesome, inserts new line without going into insert mode
map <Enter> o<ESC>
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
colorscheme Tomorrow-Night-Eighties
set background=light
"highlight Normal ctermbg=NONE
"highlight nonText ctermbg=NONE
" Always show statusline
set laststatus=2
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
set omnifunc=rubycomplete#Complete
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
if has("autocmd")
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby let g:rubycomplete_buffer_loading=1
autocmd FileType ruby let g:rubycomplete_classes_in_global=1
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment