Skip to content

Instantly share code, notes, and snippets.

@jakehasler
Last active October 31, 2016 03:46
Show Gist options
  • Save jakehasler/7eb5eeafd71d79f2330a7b48266e60db to your computer and use it in GitHub Desktop.
Save jakehasler/7eb5eeafd71d79f2330a7b48266e60db to your computer and use it in GitHub Desktop.

Revisions

  1. jakehasler revised this gist Oct 31, 2016. 1 changed file with 72 additions and 48 deletions.
    120 changes: 72 additions & 48 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,8 @@
    " vim:foldmethod=marker
    " Basic Config {{{
    set nocompatible
    filetype plugin indent on
    syntax on
    colorscheme onedark
    syntax enable
    let mapleader = ' '

    set number
    set tabstop=2
    set shiftwidth=2
    @@ -14,36 +13,61 @@ set t_Co=16
    set nobackup
    set nowritebackup
    set noswapfile
    set incsearch
    set wildmenu
    set fileformats=unix,dos,mac
    :set mouse=a
    let mapleader = ' '
    let g:jsx_ext_required = 0
    map <C-t> :tabe
    set backspace=indent,eol,start
    set mouse=a
    set nocompatible
    filetype plugin indent on

    " Changes cursor type depending on the mode
    if exists('$TMUX')
    let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
    let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
    else
    let &t_SI = "\<Esc>]50;CursorShape=1\x7"
    let &t_EI = "\<Esc>]50;CursorShape=0\x7"
    endif
    autocmd InsertEnter * set cul
    autocmd InsertLeave * set nocul

    " yank to clipboard
    if has("clipboard")
    set clipboard=unnamed " copy to the system clipboard
    if has("unnamedplus") " X11 support
    set clipboard+=unnamedplus
    endif
    endif

    " *** KEYBINDINGS ***
    " Go to last active tab
    nnoremap <C-H> <C-W>w
    noremap <C-h> <C-w>h
    noremap <C-j> <C-w>j
    noremap <C-k> <C-w>k
    noremap <C-l> <C-w>l
    noremap <leader>1 1gt
    noremap <leader>2 2gt
    noremap <leader>3 3gt
    noremap <leader>4 4gt
    noremap <leader>5 5gt
    noremap <leader>6 6gt
    noremap <leader>7 7gt
    noremap <leader>8 8gt
    noremap <leader>9 9gt
    noremap <leader>0 :tablast<cr>
    nnoremap <Leader>p :call PickFile()<CR>
    nnoremap <Leader>s :call PickFileSplit()<CR>
    nnoremap <Leader>v :call PickFileVerticalSplit()<CR>
    nnoremap <Leader>t :call PickFileTab()<CR>
    nnoremap <Leader>b :call PickBuffer()<CR>
    nnoremap <Leader>] :call PickTag()<CR>
    " set foldmethod=indent "fold based on indent
    " set foldnestmax=10 "deepest fold is 10 levels
    " set nofoldenable "dont fold by default
    noremap H ^
    noremap L $
    " Map to make it easier to source vim config file
    nnoremap <leader>sv :source $MYVIMRC<cr>
    " Easily open up vim config
    nnoremap <leader>ev :vsplit $MYVIMRC<cr>
    " Select and tab now possible
    vnoremap < <gv
    vnoremap > >gv
    " IO.inspect insertion on the page
    imap ioo IO.inspect
    " Console log from insert mode; Puts focus inside parentheses
    imap cll console.log();<Esc>==f(a
    " Console log from visual mode on next line, puts visual selection inside parentheses
    vmap cll yocll<Esc>p
    " " Console log from normal mode, inserted on next line with word your on inside parentheses
    nmap cll yiwocll<Esc>p
    " Formats JSON
    com! FormatJSON %!python -m json.tool

    " *** SETTINGS ***
    " Setting: Highlight trailing whitespace
    highlight ExtraWhitespace ctermbg=red guibg=red
    match ExtraWhitespace /\s\+$/
    @@ -63,39 +87,39 @@ function! TrimWhiteSpace()
    call cursor(l, c)
    endfunction
    autocmd BufWritePre * :call TrimWhiteSpace()
    " Set clipboard for Tmux copy/paste support
    set clipboard=unnamed
    " Setting: Allow me to paste multiple times
    xnoremap p pgvy
    " Automatically resize splits when window is resized
    au VimResized * exe "normal! \<c-w>="
    " Store swap files in fixed location, not current directory.
    set dir=~/.vimswap//,/var/tmp//,/tmp//,.
    " }}}
    " Plugins {{{

    " *** PLUGINS ***
    call plug#begin()
    Plug 'tpope/vim-fugitive'
    Plug 'jistr/vim-nerdtree-tabs'
    map <Leader>n <plug>NERDTreeTabsToggle<CR>
    Plug 'scrooloose/nerdtree'
    Plug 'thoughtbot/pick.vim'
    nnoremap <Leader>p :call PickFile()<CR>
    nnoremap <Leader>s :call PickFileSplit()<CR>
    nnoremap <Leader>v :call PickFileVerticalSplit()<CR>
    nnoremap <Leader>t :call PickFileTab()<CR>
    nnoremap <Leader>b :call PickBuffer()<CR>
    nnoremap <Leader>] :call PickTag()<CR>
    Plug 'scrooloose/nerdtree'
    map <Leader>n <plug>NERDTreeTabsToggle<CR>
    let g:pick_height = 10
    Plug 'vim-scripts/tComment'
    map <Leader>/ :TComment<CR>
    map <CR> :TComment<CR>
    map <Leader>/ :TComment<CR>
    map <CR> :TComment<CR>
    Plug 'vim-airline/vim-airline'
    Plug 'vim-airline/vim-airline-themes'
    noremap <Leader>g :GitGutterToggle<CR>
    let g:airline_theme='badwolf'
    let g:airline_powerline_fonts = 1
    noremap <Leader>g :GitGutterToggle<CR>
    let g:airline_theme='badwolf'
    let g:airline_powerline_fonts = 1
    Plug 'airblade/vim-gitgutter'
    Plug 'terryma/vim-multiple-cursors'
    Plug 'pangloss/vim-javascript'
    Plug 'mxw/vim-jsx'
    Plug 'sheerun/vim-polyglot'
    let g:jsx_ext_required = 0
    Plug 'mileszs/ack.vim'
    let g:ackprg = 'ag --nogroup --column'
    Plug 'elixir-lang/vim-elixir'
    call plug#end()
    " }}}
    " Theme {{{
    colorscheme onedark
    " }}}
    " Setting: Allow me to paste multiple times
    "" http://stackoverflow.com/questions/7163947/vim-paste-multiple-times
    xnoremap p pgvy
  2. jakehasler created this gist Oct 19, 2016.
    101 changes: 101 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,101 @@
    " vim:foldmethod=marker
    " Basic Config {{{
    set nocompatible
    filetype plugin indent on
    syntax on
    syntax enable
    set number
    set tabstop=2
    set shiftwidth=2
    set expandtab
    set nowrap
    set linebreak
    set t_Co=16
    set nobackup
    set nowritebackup
    set noswapfile
    set fileformats=unix,dos,mac
    :set mouse=a
    let mapleader = ' '
    let g:jsx_ext_required = 0
    map <C-t> :tabe
    " Go to last active tab
    nnoremap <C-H> <C-W>w
    noremap <C-h> <C-w>h
    noremap <C-j> <C-w>j
    noremap <C-k> <C-w>k
    noremap <C-l> <C-w>l
    noremap <leader>1 1gt
    noremap <leader>2 2gt
    noremap <leader>3 3gt
    noremap <leader>4 4gt
    noremap <leader>5 5gt
    noremap <leader>6 6gt
    noremap <leader>7 7gt
    noremap <leader>8 8gt
    noremap <leader>9 9gt
    noremap <leader>0 :tablast<cr>
    nnoremap <Leader>p :call PickFile()<CR>
    nnoremap <Leader>s :call PickFileSplit()<CR>
    nnoremap <Leader>v :call PickFileVerticalSplit()<CR>
    nnoremap <Leader>t :call PickFileTab()<CR>
    nnoremap <Leader>b :call PickBuffer()<CR>
    nnoremap <Leader>] :call PickTag()<CR>
    " set foldmethod=indent "fold based on indent
    " set foldnestmax=10 "deepest fold is 10 levels
    " set nofoldenable "dont fold by default
    " Setting: Highlight trailing whitespace
    highlight ExtraWhitespace ctermbg=red guibg=red
    match ExtraWhitespace /\s\+$/
    autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
    autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
    autocmd InsertLeave * match ExtraWhitespace /\s\+$/
    " Setting: Italicize comments
    let &t_ZH="\e[3m"
    let &t_ZR="\e[23m"
    highlight Comment cterm=italic
    " Setting: Trim trailing spaces on save
    function! TrimWhiteSpace()
    let l = line(".")
    let c = col(".")
    %s/\s\+$//e
    %s/\r//ge
    call cursor(l, c)
    endfunction
    autocmd BufWritePre * :call TrimWhiteSpace()
    " Set clipboard for Tmux copy/paste support
    set clipboard=unnamed
    " Automatically resize splits when window is resized
    au VimResized * exe "normal! \<c-w>="
    " Store swap files in fixed location, not current directory.
    set dir=~/.vimswap//,/var/tmp//,/tmp//,.
    " }}}
    " Plugins {{{
    call plug#begin()
    Plug 'tpope/vim-fugitive'
    Plug 'jistr/vim-nerdtree-tabs'
    map <Leader>n <plug>NERDTreeTabsToggle<CR>
    Plug 'scrooloose/nerdtree'
    Plug 'thoughtbot/pick.vim'
    let g:pick_height = 10
    Plug 'vim-scripts/tComment'
    map <Leader>/ :TComment<CR>
    map <CR> :TComment<CR>
    Plug 'vim-airline/vim-airline'
    Plug 'vim-airline/vim-airline-themes'
    noremap <Leader>g :GitGutterToggle<CR>
    let g:airline_theme='badwolf'
    let g:airline_powerline_fonts = 1
    Plug 'airblade/vim-gitgutter'
    Plug 'terryma/vim-multiple-cursors'
    Plug 'pangloss/vim-javascript'
    Plug 'mxw/vim-jsx'
    Plug 'sheerun/vim-polyglot'
    call plug#end()
    " }}}
    " Theme {{{
    colorscheme onedark
    " }}}
    " Setting: Allow me to paste multiple times
    "" http://stackoverflow.com/questions/7163947/vim-paste-multiple-times
    xnoremap p pgvy