Last active
November 20, 2019 02:10
-
-
Save geocodinglife/7f31cdcc88a64c3acf64afcbee612bf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
" For vundle | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
Bundle "MarcWeber/vim-addon-mw-utils" | |
Bundle "tomtom/tlib_vim" | |
Bundle "honza/vim-snippets" | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'gmarik/vundle' | |
Bundle 'tpope/vim-rails.git' | |
Bundle 'garbas/vim-snipmate' | |
Bundle 'tomtom/tcomment_vim' | |
Bundle 'tomasr/molokai' | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'tpope/vim-surround' | |
Bundle 'jiangmiao/auto-pairs' | |
Bundle 'ervandew/supertab' | |
Bundle 'kien/ctrlp.vim' | |
Bundle 'janko-m/vim-test' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'tpope/vim-dispatch' | |
Bundle 'plasticboy/vim-markdown' | |
Bundle 'dart-lang/dart-vim-plugin' | |
Bundle 'thosakwe/vim-flutter' | |
Bundle 'xolox/vim-notes' | |
Bundle 'xolox/vim-misc' | |
Bundle 'dense-analysis/ale' | |
Bundle 'gmarik/Vundle.vim' | |
Bundle 'slim-template/vim-slim.git' | |
Bundle 'jreybert/vimagit' | |
Bundle 'itchyny/lightline.vim' | |
Bundle 'airblade/vim-gitgutter' | |
filetype plugin indent on | |
" Ruby stuff: Thanks Ben :) | |
" ================ | |
syntax on " Enable syntax highlighting | |
filetype plugin indent on " Enable filetype-specific indenting and plugins | |
augroup myfiletypes | |
" Clear old autocmds in group | |
autocmd! | |
" autoindent with two spaces, always expand tabs | |
autocmd FileType dart,ruby,eruby,python,yaml,markdown,javascript,css set ai sw=2 sts=2 et | |
augroup END | |
" ================ | |
" Syntax highlighting and theme | |
syntax enable | |
" Configs to make Molokai look great | |
set background=dark | |
let g:molokai_original=1 | |
let g:rehash256=1 | |
set t_Co=256 | |
colorscheme molokai | |
" | |
" | |
" | |
" | |
" Show trailing whitespace and spaces before a tab: | |
:highlight ExtraWhitespace ctermbg=red guibg=red | |
:autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\\t/ | |
" Lovely linenumbers | |
set nu | |
" My leader key | |
let mapleader="," | |
let NERDTreeShowHidden=1 | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Remove highlights with leader + enter | |
nmap <Leader><CR> :nohlsearch<cr> | |
map <C-n> :NERDTreeToggle<CR> | |
" Buffer switching | |
map <leader>p :bp<CR> " \p previous buffer | |
map <leader>n :bn<CR> " \n next buffer | |
map <leader>d :bd<CR> " \d delete buffer | |
map <Leader>c :call <CR> | |
nmap <silent> <leader>c :TestFile<CR> | |
nmap <silent> <leader>s :TestNearest<CR> | |
map <leader>t :A<CR> " \t to jump to test file | |
map <leader>r :r<cr> " \t to jump to related file | |
set laststatus=2 | |
" Don't be a noob, join the no arrows key movement | |
inoremap <Up> <NOP> | |
inoremap <Down> <NOP> | |
inoremap <Left> <NOP> | |
inoremap <Right> <NOP> | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
" bind \ (backward slash) to grep shortcut | |
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw! | |
nnoremap \ :Ag<SPACE> | |
" Removing escape | |
ino jj <esc> | |
cno jj <c-c> | |
vno v <esc> | |
" highlight the current line | |
set cursorline | |
" Highlight active column | |
set cuc cul" | |
" Tab completion | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
"""""""""""""""""""""""""""""""""""""""" | |
" BACKUP / TMP FILES | |
"""""""""""""""""""""""""""""""""""""""" | |
if isdirectory($HOME . '/.vim/backup') == 0 | |
:silent !mkdir -p ~/.vim/backup >/dev/null 2>&1 | |
endif | |
set backupdir-=. | |
set backupdir+=. | |
set backupdir-=~/ | |
set backupdir^=~/.vim/backup/ | |
set backupdir^=./.vim-backup/ | |
set backup | |
" Save your swp files to a less annoying place than the current directory. | |
" " If you have .vim-swap in the current directory, it'll use that. | |
" " Otherwise it saves it to ~/.vim/swap, ~/tmp or . | |
if isdirectory($HOME . '/.vim/swap') == 0 | |
:silent !mkdir -p ~/.vim/swap >/dev/null 2>&1 | |
endif | |
set directory=./.vim-swap// | |
set directory+=~/.vim/swap// | |
set directory+=~/tmp// | |
set directory+=. | |
" viminfo stores the the state of your previous editing session | |
set viminfo+=n~/.vim/viminfo | |
if exists("+undofile") | |
" undofile - This allows you to use undos after exiting and restarting | |
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo | |
" :help undo-persistence | |
" This is only present in 7.3+ | |
if isdirectory($HOME . '/.vim/undo') == 0 | |
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 | |
endif | |
set undodir=./.vim-undo// | |
set undodir+=~/.vim/undo// | |
set undofile | |
endif | |
" bind K to grep word under cursor | |
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR> | |
" The Silver Searcher | |
if executable('ag') | |
" Use ag over grep | |
set grepprg=ag\ --nogroup\ --nocolor | |
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
" ag is fast enough that CtrlP doesn't need to cache | |
let g:ctrlp_use_caching = 0 | |
endif | |
" Ruby hash syntax conversion | |
nnoremap <F12> :%s/:\([^ ]*\)\(\s*\)=>/\1:/g<return> | |
nmap <Leader><CR> :nohlsearch<cr> | |
map <leader>q :NERDTreeToggle<CR> | |
set clipboard=unnamed | |
if has('nvim') | |
let test#strategy = "neovim" | |
else | |
let test#strategy = "dispatch" | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment