Skip to content

Instantly share code, notes, and snippets.

@jeffpamer
Created September 30, 2016 20:31
Show Gist options
  • Save jeffpamer/02c84ed0d80863e30d5c45d290f2f162 to your computer and use it in GitHub Desktop.
Save jeffpamer/02c84ed0d80863e30d5c45d290f2f162 to your computer and use it in GitHub Desktop.
Neovim Init
"Dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
set runtimepath+=/Users/jeffpamer/.config/nvim/repos/github.com/Shougo/dein.vim
call dein#begin('/Users/jeffpamer/.config/nvim')
" Let dein manage dein
call dein#add('Shougo/dein.vim')
" Add or remove your plugins here:
call dein#add('Shougo/denite.nvim')
call dein#add('Shougo/deoplete.nvim')
call dein#add('mhartington/oceanic-next')
call dein#add('othree/yajs.vim')
call dein#add('othree/es.next.syntax.vim')
call dein#add('nixprime/cpsm')
call dein#end()
filetype plugin indent on
"End dein Scripts-------------------------
let g:deoplete#enable_at_startup = 1
if !exists('g:deoplete#omni#input_patterns')
let g:deoplete#omni#input_patterns = {}
endif
if (has("termguicolors"))
set termguicolors
endif
" Theme
syntax enable
colorscheme OceanicNext
set background=dark
" enable italics, disabled by default
let g:oceanic_next_terminal_italic = 1
" enable bold, disabled by default
let g:oceanic_next_terminal_bold = 1
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
" General settings
filetype plugin indent on
set tabstop=4 shiftwidth=4 expandtab
set foldcolumn=0
set conceallevel=0
set virtualedit=
set wildmenu
set laststatus=2
set wrap linebreak nolist
set wildmode=full
let mapleader = ','
set undofile
set undodir="$HOME/.VIM_UNDO_FILES"
let g:jsx_ext_required = 0
let g:gitgutter_max_signs = 1000 " default value
set shell=/bin/bash\ -i
" Deoplete
let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_completion_start_length = 1
if !exists('g:deoplete#omni#input_patterns')
let g:deoplete#omni#input_patterns = {}
endif
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
imap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" omnifuncs
set completeopt-=preview
augroup omnifuncs
autocmd!
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
augroup end
" Keymaps -------------------------------------------------------------
nnoremap ; :
nnoremap <TAB><TAB> :b#<CR>
nnoremap <silent> <leader><leader> :bnext<CR>
nnoremap <silent> mm :bprevious<CR>
vnoremap <C-c> "*y<CR>
vnoremap y "*y<CR>
nnoremap Y "*Y<CR>
" Align blocks of text and keep them selected
vmap < <gv
vmap > >gv
" Theme
syntax enable
colorscheme OceanicNext
set background=dark
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE
set t_Co=256
let g:vimjs#casesensistive = 1
let g:vimjs#smartcomplete = 1
" Denite ------------------------------------------------------------------------
" Change file_rec command.
call denite#custom#var('file_rec', 'command',
\ ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''])
" Change mappings.
call denite#custom#map('_', "\<C-j>", 'move_to_next_line')
call denite#custom#map('_', "\<C-k>", 'move_to_prev_line')
" Change matchers.
call denite#custom#source(
\ 'file_mru', 'matchers', ['matcher_fuzzy', 'matcher_project_files'])
call denite#custom#source(
\ 'file_rec', 'matchers', ['matcher_fuzzy', 'matcher_project_files'])
nnoremap <silent> <c-p> :Denite file_rec<CR>
nnoremap <silent> <leader>u :call dein#update()<CR>
nnoremap <silent> <leader>i :call dein#install()<CR>
" Git from unite ---------------------------------------------------------------
let g:unite_source_menu_menus = {} " Useful when building interfaces at appropriate places
let g:unite_source_menu_menus.git = {
\ 'description' : 'Fugitive interface',
\}
let g:unite_source_menu_menus.git.command_candidates = [
\[' git status', 'Gstatus'],
\[' git diff', 'Gvdiff'],
\[' git commit', 'Gcommit'],
\[' git stage/add', 'Gwrite'],
\[' git checkout', 'Gread'],
\[' git rm', 'Gremove'],
\[' git cd', 'Gcd'],
\[' git push', 'exe "Git! push " input("remote/branch: ")'],
\[' git pull', 'exe "Git! pull " input("remote/branch: ")'],
\[' git pull rebase', 'exe "Git! pull --rebase " input("branch: ")'],
\[' git checkout branch', 'exe "Git! checkout " input("branch: ")'],
\[' git fetch', 'Gfetch'],
\[' git merge', 'Gmerge'],
\[' git browse', 'Gbrowse'],
\[' git head', 'Gedit HEAD^'],
\[' git parent', 'edit %:h'],
\[' git log commit buffers', 'Glog --'],
\[' git log current file', 'Glog -- %'],
\[' git log last n commits', 'exe "Glog -" input("num: ")'],
\[' git log first n commits', 'exe "Glog --reverse -" input("num: ")'],
\[' git log until date', 'exe "Glog --until=" input("day: ")'],
\[' git log grep commits', 'exe "Glog --grep= " input("string: ")'],
\[' git log pickaxe', 'exe "Glog -S" input("string: ")'],
\[' git index', 'exe "Gedit " input("branchname\:filename: ")'],
\[' git mv', 'exe "Gmove " input("destination: ")'],
\[' git grep', 'exe "Ggrep " input("string: ")'],
\[' git prompt', 'exe "Git! " input("command: ")'],
\] " Append ' --' after log to get commit info commit buffers
nnoremap <silent> <Leader>g :Unite -direction=botright -silent -buffer-name=git -start-insert menu:git<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment