Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible
- filetype off
- " set the runtime path to include Vundle and initialize
- set rtp+=~/.vim/bundle/vundle/
- call vundle#begin()
- " PLUGINS
- Plugin 'VundleVim/Vundle.vim'
- Plugin 'scrooloose/nerdtree'
- Plugin 'majutsushi/tagbar'
- Plugin 'ctrlpvim/ctrlp.vim'
- Plugin 'bumaociyuan/vim-swift'
- Plugin 'arcticicestudio/nord-vim'
- Plugin 'artur-shaik/vim-javacomplete2'
- Plugin 'tpope/vim-fugitive'
- Plugin 'tpope/vim-commentary'
- Plugin 'dyng/ctrlsf.vim'
- Plugin 'mileszs/ack.vim'
- Plugin 'vim-airline/vim-airline'
- Plugin 'junegunn/goyo.vim'
- Plugin 'godlygeek/tabular'
- Plugin 'sjl/gundo.vim'
- Plugin 'w0rp/ale'
- Plugin 'realm/SwiftLint'
- " All of your Plugins must be added before the following line
- call vundle#end() " required
- filetype plugin indent on " required
- " Nice-to-haves
- set number
- set nolist
- set nospell
- set hlsearch
- syntax on
- set tags=./tags,tags;$HOME
- colorscheme nord
- set backspace=2
- set scrolloff=3
- set gcr=a:blinkon0
- set relativenumber
- set binary
- set noeol
- " SEARCH
- set ignorecase
- set incsearch
- set cursorline
- " SPLITS
- nmap <C-v> :vsplit<CR>
- nmap <C-h> :split<CR>
- " KEYBINDINGS
- nnoremap <C-e> :NERDTreeToggle<CR>
- nnoremap <C-p> :CtrlP<CR>
- " SEARCH NAVIGATION
- nmap <C-t> :TagbarToggle<CR>
- let g:ackprg = 'ag --vimgrep'
- " HARDMODE
- inoremap <Up> <Nop>
- inoremap <Down> <Nop>
- inoremap <Left> <Nop>
- inoremap <Right> <Nop>
- " SEARCH - KEYBINDINGS
- nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
- " Toggle Line numbers
- noremap <C-l> :set invnumber<CR>
- if has('mouse')
- set mouse=a
- endif
- " SILVER SEARCH
- 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
- " OPEN FILES IN NEW TAB
- let g:ctrlp_prompt_mappings = {
- \ 'AcceptSelection("e")': ['<c-t>'],
- \ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
- \ }
- let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
- " AUTO SOURCE VIMRC
- if has("autocmd")
- autocmd bufwritepost .vimrc source $MYVIMRC
- endif
- set showtabline=2
- set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
- filetype plugin on
- function! GitResetAll()
- !git reset HEAD --hard
- endfunction
- command! GitResetAll call GitResetAll()
- nmap \r :GitResetAll<CR>
- nmap \q :ccl<CR>
- nmap \hl :set invhlsearch<CR>
- nmap \t : NERDTree %<CR>
- let g:ale_fixers = {
- \ 'swift': ['swiftformat'],
- \}
- let g:ale_fix_on_save = 1
- cnoreabbrev W! w!
- cnoreabbrev Q! q!
- cnoreabbrev Qall! qall!
- cnoreabbrev Wq wq
- cnoreabbrev Wa wa
- cnoreabbrev wQ wq
- cnoreabbrev WQ wq
- cnoreabbrev W w
- cnoreabbrev Q q
- cnoreabbrev Qall qall
- let g:NERDTreeWinSize = 30
- packloadall
- silent! helptags All
- " quickfixopenall.vim
- "Author:
- " Tim Dahlin
- "
- "Description:
- " Opens all the files in the quickfix list for editing.
- "
- "Usage:
- " 1. Perform a vimgrep search
- " :vimgrep /def/ *.rb
- " 2. Issue QuickFixOpenAll command
- " :QuickFixOpenAll
- function! QuickFixOpenAll()
- if empty(getqflist())
- return
- endif
- let s:prev_val = ""
- for d in getqflist()
- let s:curr_val = bufname(d.bufnr)
- if (s:curr_val != s:prev_val)
- exec "edit " . s:curr_val
- endif
- let s:prev_val = s:curr_val
- endfor
- endfunction
- command! QuickFixOpenAll call QuickFixOpenAll()
- " Rename.vim - Rename a buffer within Vim and on the disk
- "
- " Copyright June 2007-2011 by Christian J. Robinson <heptite@gmail.com>
- "
- " Distributed under the terms of the Vim license. See ":help license".
- "
- " Usage:
- "
- " :Rename[!] {newname}
- command! -nargs=* -complete=file -bang Rename call Rename(<q-args>, '<bang>')
- function! Rename(name, bang)
- let l:name = a:name
- let l:oldfile = expand('%:p')
- if bufexists(fnamemodify(l:name, ':p'))
- if (a:bang ==# '!')
- silent exe bufnr(fnamemodify(l:name, ':p')) . 'bwipe!'
- else
- echohl ErrorMsg
- echomsg 'A buffer with that name already exists (use ! to override).'
- echohl None
- return 0
- endif
- endif
- let l:status = 1
- let v:errmsg = ''
- silent! exe 'saveas' . a:bang . ' ' . l:name
- if v:errmsg =~# '^$\|^E329'
- let l:lastbufnr = bufnr('$')
- if expand('%:p') !=# l:oldfile && filewritable(expand('%:p'))
- if fnamemodify(bufname(l:lastbufnr), ':p') ==# l:oldfile
- silent exe l:lastbufnr . 'bwipe!'
- else
- echohl ErrorMsg
- echomsg 'Could not wipe out the old buffer for some reason.'
- echohl None
- let l:status = 0
- endif
- if delete(l:oldfile) != 0
- echohl ErrorMsg
- echomsg 'Could not delete the old file: ' . l:oldfile
- echohl None
- let l:status = 0
- endif
- else
- echohl ErrorMsg
- echomsg 'Rename failed for some reason.'
- echohl None
- let l:status = 0
- endif
- else
- echoerr v:errmsg
- let l:status = 0
- endif
- return l:status
- endfunction
Add Comment
Please, Sign In to add comment