Created
February 19, 2019 21:49
-
-
Save hashmap/786edee7541216ae60258af3c96f0b80 to your computer and use it in GitHub Desktop.
init.vim
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
"dein Scripts----------------------------- | |
if &compatible | |
set nocompatible " Be iMproved | |
endif | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
" Or if you have Neovim >= 0.1.5 | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
let g:python2_host_prog = '/usr/local/bin/python' | |
let g:python3_host_prog = '/usr/local/bin/python3' | |
" Required: | |
set runtimepath+=/Users/alex/.cache/dein/repos/github.com/Shougo/dein.vim | |
" Required: | |
if dein#load_state('/Users/alex/.cache/dein') | |
call dein#begin('/Users/alex/.cache/dein') | |
" Let dein manage dein | |
" Required: | |
call dein#add('/Users/alex/.cache/dein/repos/github.com/Shougo/dein.vim') | |
" Add or remove your plugins here: | |
call dein#add('Shougo/neosnippet.vim') | |
call dein#add('Shougo/neosnippet-snippets') | |
call dein#add('scrooloose/nerdtree') | |
call dein#add('vim-syntastic/syntastic') | |
call dein#add('ctrlpvim/ctrlp.vim') | |
call dein#add('Shougo/deoplete.nvim') | |
"call dein#add('zchee/deoplete-go', {'build': 'make'}) | |
call dein#add('Shougo/neopairs.vim') | |
"call dein#add('zefei/vim-wintabs') | |
call dein#add('fatih/vim-go') | |
call dein#add('Raimondi/delimitMate') | |
"" call dein#add('majutsushi/tagbar') | |
call dein#add('rking/ag.vim') | |
call dein#add('vim-airline/vim-airline') | |
call dein#add('altercation/vim-colors-solarized') | |
call dein#add('rust-lang/rust.vim') | |
call dein#add('racer-rust/vim-racer') | |
call dein#add('timonv/vim-cargo') | |
call dein#add('jremmen/vim-ripgrep') | |
call dein#add('sebastianmarkow/deoplete-rust') | |
" call dein#add('tomlion/vim-solidity') | |
call dein#add('easymotion/vim-easymotion') | |
call dein#add('autozimu/LanguageClient-neovim', { 'rev': 'next', 'build': 'bash install.sh' }) | |
" You can specify revision/branch/tag. | |
call dein#add('Shougo/deol.nvim', { 'rev': 'a1b5108fd' }) | |
call dein#add('mhartington/oceanic-next') | |
call dein#add('neomake/neomake') | |
" Required: | |
call dein#end() | |
call dein#save_state() | |
endif | |
" Required: | |
filetype plugin indent on | |
syntax enable | |
" If you want to install not installed plugins on startup. | |
if dein#check_install() | |
call dein#install() | |
endif | |
colorscheme OceanicNext | |
"End dein Scripts------------------------- | |
" | |
" Basic setup | |
set noerrorbells | |
set mouse=a | |
set clipboard=unnamed | |
set autoread | |
set autowrite | |
set hidden | |
set noswapfile " Don't use swapfile | |
set nobackup " Don't create annoying backup fileset modelines=0 | |
set encoding=utf-8 | |
set number | |
"set relativenumber | |
"set foldenable " enable folding | |
"set foldlevelstart=10 " open most folds by default | |
"set foldnestmax=10 " 10 nested fold max | |
let mapleader = ' ' | |
set backspace=indent,eol,start | |
:vmap y ygv<Esc> | |
:vmap P o<>p | |
"nnoremap / /\v | |
"vnoremap / /\v | |
" | |
set splitright | |
set cmdheight=2 | |
" Search | |
set gdefault | |
set incsearch | |
set hlsearch " highlight matches | |
set showmatch | |
set ignorecase | |
set smartcase | |
map <C-n> :NERDTreeToggle<CR> | |
" some leader remaps | |
nnoremap <Leader>w :w<CR> | |
vmap <Leader>y "+y | |
vmap <Leader>d "+d | |
nmap <Leader>p "+p | |
nmap <Leader>P "+P | |
vmap <Leader>p "+p | |
vmap <Leader>P "+P | |
" Go to tab by number | |
noremap <leader>1 1gt | |
noremap <leader>2 2gt | |
noremap <leader>3 3gt | |
noremap <leader>4 4gt | |
noremap <leader>5 5gt | |
noremap <leader>6 6gt | |
noremap <leader>7 7gt | |
noremap <leader>8 8gt | |
noremap <leader>9 9gt | |
noremap <leader>0 :tablast<cr> | |
vmap <Leader>q :ccl<CR> | |
vmap <Leader>o :cope<CR> | |
" Configure deoplete and subcandidates | |
let g:deoplete#enable_at_startup = 1 | |
let g:deoplete#enable_smart_case = 1 | |
let g:neopairs#enable = 1 | |
" Syntactic | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
" Ctrl-P plugin | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_cmd = 'CtrlP' | |
let g:ctrlp_working_path_mode = 'ar' | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/vendor/* | |
map <C-b> :CtrlPBuffer<CR> | |
"let g:ctrlp_root_markers = ['Cargo.toml'] | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] | |
" Go conf | |
" run :GoBuild or :GoTestCompile based on the go file | |
au FileType go nmap ga :GoAlternate<CR> | |
au Filetype go nmap gah <Plug>(go-alternate-split) | |
au Filetype go nmap gav <Plug>(go-alternate-vertical) | |
au FileType go nmap gc :GoCoverageToggle -short<cr> | |
let g:go_fmt_command = "goimports" | |
let g:go_def_mode = "godef" | |
function! s:build_go_files() | |
let l:file = expand('%') | |
if l:file =~# '^\f\+_test\.go$' | |
call go#cmd#Test(0, 1) | |
elseif l:file =~# '^\f\+\.go$' | |
call go#cmd#Build(0) | |
endif | |
endfunction | |
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR> | |
autocmd FileType go nmap <leader>t <Plug>(go-test) | |
au FileType go nmap gt :GoDeclsDir<cr> | |
let g:go_def_mapping_enabled = 1 | |
let g:go_highlight_types = 1 | |
let g:go_highlight_fields = 1 | |
let g:go_addtags_transform = 'camelcase' | |
"let g:go_metalinter_autosave = 1 | |
" let g:go_gocode_socket_type = "tcp" | |
let g:go_auto_type_info = 1 | |
set updatetime=100 | |
" Rust | |
set hidden | |
let g:racer_cmd = "/Users/alex/.cargo/bin/racer" | |
let g:racer_experimental_completer = 1 | |
let g:rustfmt_autosave = 1 | |
let g:rust_recommended_style = 0 | |
let g:neomake_open_list = 2 | |
let g:deoplete#sources#rust#racer_binary='/Users/alex/.cargo/bin/racer' | |
let g:deoplete#sources#rust#rust_source_path='/Users/alex/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src' | |
let g:deoplete#sources#rust#documentation_max_height=10 | |
let g:deoplete#sources#rust#disable_keymap=1 | |
au FileType rust nmap gd <Plug>(rust-def) | |
" au FileType rust nmap gs <Plug>(rust-def-split) | |
" au FileType rust nmap gx <Plug>(rust-def-vertical) | |
" au FileType rust nmap <leader>gd <Plug>(rust-doc) | |
" | |
"au FileType rust nmap K :call LanguageClient_textDocument_hover()<CR> | |
" au FileType rust nmap gd :call LanguageClient_textDocument_definition()<CR> | |
"au FileType rust nmap<F2> :call LanguageClient_textDocument_rename()<CR> | |
" let g:syntastic_loc_list_height = 5 | |
" let g:syntastic_rust_checkers = ['cargo'] | |
"let g:LanguageClient_serverCommands = { | |
"" \ 'rust': ['rustup', 'run', 'beta', 'rls'], | |
"" \ } | |
"let g:LanguageClient_loggingLevel = 'DEBUG' | |
autocmd FileType rust nmap <leader>b :Neomake<CR> | |
autocmd FileType rust nmap <leader>t :CargoTest<CR> | |
" Misc | |
" text trasnforming | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set softtabstop=0 noexpandtab | |
set autoindent | |
"map <C-H> <Plug>(wintabs_previous) | |
"map <C-L> <Plug>(wintabs_next) | |
"map <C-T>c <Plug>(wintabs_close) | |
"map <C-T>u <Plug>(wintabs_undo) | |
"map <C-T>o <Plug>(wintabs_only) | |
"map <C-W>c <Plug>(wintabs_close_window) | |
"map <C-W>o <Plug>(wintabs_only_window) | |
"command! Tabc WintabsCloseVimtab | |
"command! Tabo WintabsOnlyVimtab | |
"nmap <Leader>s :TagbarToggle<CR> | |
" | |
"let g:tagbar_type_rust = { | |
" \ 'ctagstype' : 'rust', | |
" \ 'kinds' : [ | |
" \'T:types,type definitions', | |
" \'f:functions,function definitions', | |
" \'g:enum,enumeration names', | |
" \'s:structure names', | |
" \'m:modules,module names', | |
" \'c:consts,static constants', | |
" \'t:traits', | |
" \'i:impls,trait implementations', | |
" \] | |
" \} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment