Skip to content

Instantly share code, notes, and snippets.

@crasiak
Created October 29, 2017 02:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crasiak/3381534a08c55f8919c12ebd71b6a3d8 to your computer and use it in GitHub Desktop.
Save crasiak/3381534a08c55f8919c12ebd71b6a3d8 to your computer and use it in GitHub Desktop.
my init.vim for neovim
" init.vim with dein plugin manager
" valerino, 2k17
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" mandatory
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if &compatible
set nocompatible
endif
filetype off
set runtimepath+=~/.vim/bundles/repos/github.com/Shougo/dein.vim
if dein#load_state('~/.vim/bundles')
call dein#begin('~/.vim/bundles')
call dein#add('~/.vim/bundles/repos/github.com/Shougo/dein.vim')
" dein plugins
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call dein#add('scrooloose/nerdtree')
call dein#add('jistr/vim-nerdtree-tabs')
call dein#add('freeo/vim-kalisi')
call dein#add('vim-airline/vim-airline')
call dein#add('Shougo/deoplete.nvim')
call dein#add('zchee/deoplete-clang')
call dein#add('zchee/deoplete-jedi')
call dein#add('Shougo/denite.nvim')
call dein#add('jreybert/vimagit')
call dein#add('airblade/vim-gitgutter')
call dein#add('rhysd/vim-clang-format')
"call dein#add('Shougo/neosnippet')
"call dein#add('Shougo/neosnippet-snippets')
call dein#add('honza/vim-snippets')
call dein#add('Xuyuanp/nerdtree-git-plugin')
call dein#add('ryanoasis/vim-devicons')
call dein#add('tpope/vim-fugitive')
call dein#add('majutsushi/tagbar')
call dein#add('scrooloose/nerdcommenter')
call dein#add('jiangmiao/auto-pairs')
call dein#add('tpope/vim-surround')
call dein#add('tpope/vim-sensible')
call dein#add('tpope/vim-jdaddy')
call dein#add('JamshedVesuna/vim-markdown-preview')
" Initialize plugin system
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
syntax enable
if dein#check_install()
call dein#install()
endif
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
" theme
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
colorscheme kalisi
set background=dark
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
" show ruler line/column/number
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ruler
set number
" highlight search color
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch
nnoremap <CR> :noh<CR><CR>
" open splits below
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set splitbelow
" set tabs to 4, indent to 4, tabs to spaces
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=4
set shiftwidth=4
set expandtab
" use mouse
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set mouse=a
" allow clipboard copy on osx
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set clipboard=unnamed
" set font (uses patched nerd font, install from https://github.com/ryanoasis/nerd-fonts#font-installation)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Nerd\ Font\ Complete:h11
set encoding=utf8
let g:airline_powerline_fonts = 1
" automatically refresh on change
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoread
" autoreload vimrc
autocmd! BufWritePost init.vim,.vimrc source %
" keys mapping
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <S-Right> :tabn<CR>
nmap <S-Left> :tabp<CR>
"nmap <S-Up> <C-W>w
"nmap <S-Down> <C-W>w
"tnoremap <Esc> <C-\><C-n>
"nmap + <C-W>+
"nmap - <C-W>-
vnoremap <leader>p "_dP
" purge orphan plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! DeinPurge()
call map(dein#check_clean(), "delete(v:val, 'rf')")
endfunction
" open a terminal with 10 lines
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! Vterm()
:10split | terminal
" call feedkeys("\<Esc>\<C-w>w\<C-w>w")
endfunction
"autocmd! VimEnter * exec Vterm()
" edit config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! Vedcfg()
:tabedit ~/.config/nvim/init.vim
endfunction
" nerdtree
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd! StdinReadPre * let s:std_in=1
autocmd! BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeShowHidden=1
let g:NERDTreeShowIgnoredStatus=1
nnoremap <Leader>f :NERDTreeToggle<Enter>
nnoremap <silent> <Leader>v :NERDTreeFind<CR>
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1
" nerdtree-tabs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:nerdtree_tabs_open_on_console_startup=1
" deoplete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:deoplete#enable_at_startup=1
let g:deoplete#sources#clang#libclang_path='/usr/lib/x86_64-linux-gnu/libclang-3.8.so.1'
let g:deoplete#sources#clang#clang_header='/usr/include/llvm-3.8/llvm'
let g:deoplete#sources#jedi#show_docstring=1
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
endfunction
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" grip for markdown preview (ctrl-p)
let vim_markdown_preview_github=1
" nerd-commenter
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDDefaultAlign = 'left'
let g:NERDAltDelims_java = 1
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
" ctags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <F8> :TagbarToggle<CR>
" clang-format
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:clang_format#auto_format=1
let g:clang_format#detect_style_file=1
let g:clang_format#auto_format_on_insert_leave=1
" neosnippet
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin key-mappings.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
"imap <C-k> <Plug>(neosnippet_expand_or_jump)
"smap <C-k> <Plug>(neosnippet_expand_or_jump)
"xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
"imap <C-k> <Plug>(neosnippet_expand_or_jump)
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
"smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" alternative snippets
"let g:neosnippet#snippets_directory='~/.local/share/dein/repos/github.com/honza/vim-snippets/snippets'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment