Skip to content

Instantly share code, notes, and snippets.

@niksaak
Created February 11, 2017 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niksaak/c851994e7292a6e322797b61470d2f08 to your computer and use it in GitHub Desktop.
Save niksaak/c851994e7292a6e322797b61470d2f08 to your computer and use it in GitHub Desktop.
set nocompatible
set background=dark
call plug#begin('~/.vim/plugged')
Plug 'mileszs/ack.vim'
Plug 'sjl/badwolf'
Plug 'vim-scripts/camelcasemotion'
Plug 'JazzCore/ctrlp-cmatcher'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'beyondmarc/hlsl.vim'
Plug 'mattn/invader-vim', {'on': 'Invader'}
Plug 'vim-scripts/lawrencium'
Plug 'scrooloose/nerdtree', {'on': ['NERDTreeToggle', 'NERDTree']}
Plug 'jaxbot/semantic-highlight.vim', {'on': ['SemanticHighlight', 'SemanticHighlightToggle']}
Plug 'mtth/scratch.vim'
Plug 'vim-scripts/Sorcerer'
Plug 'sjl/splice.vim', {'on': 'SpliceInit'}
Plug 'godlygeek/tabular', {'on': 'Tabularize'}
Plug 'majutsushi/tagbar'
Plug 'vim-scripts/taglist.vim', {'on': ['TlistOpen', 'TlistToggle']}
Plug 'mbbill/undotree', {'on': ['UndotreeShow', 'UndotreeToggle']}
Plug 'vim-scripts/unimpaired.vim'
Plug 'bling/vim-airline'
Plug 'haya14busa/vim-asterisk'
Plug 'altercation/vim-colors-solarized'
Plug 'Olical/vim-enmasse', {'on': 'EnMasse'}
Plug 'chrisbra/vim-diff-enhanced'
Plug 'nblock/vim-dokuwiki'
Plug 'tpope/vim-fugitive'
Plug 'terryma/vim-multiple-cursors', {'on': 'MultipleCursorsFind'}
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-repeat'
Plug 'kshenoy/vim-signature'
Plug 'tpope/vim-surround'
Plug 'jnurmine/Zenburn'
call plug#end()
colorscheme sorcerer
" indent
syntax on
set autoindent
set smartindent
" editor
set fileformats=unix,dos,mac
set hidden
set number
set ruler
set colorcolumn=80
set backspace=indent,eol,start
set ignorecase
set smartcase
set nohlsearch
set omnifunc=syntaxcomplete#Complete
set incsearch
set linebreak
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp1252,cp1251,default,latin1
set autoread
set wildignore+=*.exe,*.pdb,*.lib,*.dll,*.ogg,*.ogv
set wildignore+=*/Debug-iphoneos/*,*/Debug-iphonesimulator/*
set wildignore+=*/Release-iphoneos/*,*/Release-iphonesimulator/*
set breakindent
set showbreak=•••
set laststatus=2
set showtabline=2
set noshowmode
set scrolloff=0
set sidescrolloff=9001
set listchars=trail:•,extends:»,precedes:«,nbsp:¬,tab:>-,eol:¶
set wildmenu
set foldlevelstart=0
set tabstop=4 " tabs
set shiftwidth=4
set softtabstop=4
set noexpandtab
" get visual selection helper
function! s:get_visual_selection()
" Why is this not a built-in Vim script function?!
let [lnum1, col1] = getpos("'<")[1:2]
let [lnum2, col2] = getpos("'>")[1:2]
let lines = getline(lnum1, lnum2)
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][col1 - 1:]
return join(lines, "\n")
endfunction
function! s:match_selected_text()
let command = ""
if mode() ==# 'v'
let command = printf('2match IncSearch /\V%s/', escape(Asterisk#GetSelectedText(), '/\'))
else
let command = printf('%s', '2match none')
endif
exe command
endfunction
" sections
noremap ]] /\v\s*--\s*\[<CR>zz:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR>
noremap [[ ?\v\s*--\s*\[<CR>zz:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR>
" folds - space to toggle, zO to recursively open toplevel fold
nnoremap <Space> za
vnoremap <Space> za
nnoremap zO zCzO
" multiple cursors
nnoremap <Leader>/ :MultipleCursorsFind
vnoremap <Leader>/ :MultipleCursorsFind
" nishtyaks
"autocmd CursorMoved * exe printf('match CursorColumn /\V\<%s\>/', escape(expand('<cword>'), '/\'))
autocmd CursorMoved * call s:match_selected_text()
nnoremap <silent> } /\v^\s*$<CR>:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR>
nnoremap <silent> { ?\v^\s*$<CR>:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR>
" gui
set guioptions=cigt
"set guifont=Liberation_Mono:h9
set guifont=InputMono\ ExLight:h11
" project
set grepprg=grep\ -n\ -r\ $*
" middle mouse
map <MiddleMouse> /\<<C-r><C-w>\><C-M>
map <X2Mouse> N
map <X1Mouse> n
" swapfiles
set backupdir=~/.vim/backup//
set directory=~/.vim/swp//
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
nmap <F4> :Ack <C-r><C-w>
vmap <F4> <Esc> :execute 'Ack ' . <SID>:get_visual_selection() . ' \| bo cw'<CR>
" CtrlP
nnoremap <Leader><C-P> :CtrlPTag<CR>
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_working_path_mode = 'wra'
let g:ctrlp_user_command = 'ag -Ug "." %s | ag -v "(png|jpg|exe|vcxproj|util|ogv|cfg|icns|ogg|dll|psi|cur|zip|link|save|pak|bak)$" | ag -v "\.bak\/"'
"let g:ctrlp_lazy_update = 100
let g:ctrlp_match_func = { 'match' : 'matcher#cmatch' }
let g:ctrlp_match_window = 'results:128'
" Airline
let g:airline_powerline_fonts=1
" Tabular for commas
vnoremap <Leader>, :Tabularize argument_list<CR>
vnoremap <Leader>= :Tabularize assignment<CR>
" Semantic highlight
nnoremap <Leader>s :SemanticHighlightToggle<CR>
let g:semanticTermColors = [28,29,30,31,32,33, 64,65,66,67,68,69, 100,101,102,103,104,105, 136,137,138,139,140,141, 172,173,174,175,176,177, 208,209,210,211,212,213]
" UndoTree
let g:undotree_WindowLayout = 3
let g:undotree_TreeNodeShape = '•'
" Scratch
let g:scratch_insert_autohide = 0
" Asterisk
map * <Plug>(asterisk-*)
map # <Plug>(asterisk-#)
map g* <Plug>(asterisk-g*)
map g# <Plug>(asterisk-g#)
map z* <Plug>(asterisk-z*)
map gz* <Plug>(asterisk-gz*)
map z# <Plug>(asterisk-z#)
map gz# <Plug>(asterisk-gz#)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment