Skip to content

Instantly share code, notes, and snippets.

@hatoo
Last active July 23, 2018 11:26
Show Gist options
  • Save hatoo/2601af6e39a1d6b5b730d2190e7dcb4a to your computer and use it in GitHub Desktop.
Save hatoo/2601af6e39a1d6b5b730d2190e7dcb4a to your computer and use it in GitHub Desktop.
call plug#begin()
Plug 'rust-lang/rust.vim'
" Plug 'Marwes/rust.vim', {'tag': 'rustfmt_0.7'}
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" \ 'tag': '0.1.70',
" \ 'tag': '0.1.55',
Plug 'junegunn/fzf'
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" assuming your using vim-plug: https://github.com/junegunn/vim-plug
Plug 'ncm2/ncm2'
" ncm2 requires nvim-yarp
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-ultisnips'
" Plug 'roxma/nvim-completion-manager'
" if !has('nvim')
" Plug 'roxma/vim-hug-neovim-rpc'
" endif
" if has('nvim')
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" else
" Plug 'Shougo/deoplete.nvim'
" Plug 'roxma/nvim-yarp'
" Plug 'roxma/vim-hug-neovim-rpc'
" endif
Plug 'SirVer/ultisnips'
" Plug 'Shougo/neosnippet'
" Plug 'Shougo/neosnippet-snippets'
Plug 'honza/vim-snippets'
Plug 'neomake/neomake'
" MISC
" Plug 'jiangmiao/auto-pairs'
Plug 'rakr/vim-one'
Plug 'cohama/lexima.vim'
Plug 'tpope/vim-surround'
Plug 'rhysd/vim-clang-format'
" PowerLine
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"" Testing
Plug 'Shougo/denite.nvim'
Plug 'kassio/neoterm'
Plug 'scrooloose/nerdtree'
call plug#end()
set nocompatible
filetype plugin on
syntax enable
let &shell='bash --login'
set tabstop=4
set expandtab
set shiftwidth=4
colorscheme one
set t_Co=256
set t_ut=
set termguicolors
set background=dark
set mouse=a
set autoindent
set number
set smartcase
set list
set listchars=tab:>-,trail:.
"" ncm2/ncm2
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
let g:ncm2#complete_length = [[1,1], [7,1]]
" Airline
let g:airline_theme='onedark'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
"" For jiangmiao/auto-pairs
let g:AutoPairsMapCR=0
let g:AutoPairsCenterLine=0
let g:AutoPairsMultilineClose=0
"" For rhysd/vim-clang-format
let g:clang_format#auto_format=1
"" For rust-lang/rust.vim
let g:rustfmt_autosave=1
" let g:rustfmt_command='rustup run nightly rustfmt'
"" For autozimu/LanguageClient-neovim
" Required for operations modifying multiple buffers like rename.
augroup filetype_rust
autocmd!
autocmd BufReadPost *.rs setlocal filetype=rust
augroup END
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
\ 'cpp': ['~/cquery/build/release/bin/cquery', '--language-server']
\ }
let g:LanguageClient_autoStart = 1
let g:LanguageClient_settingsPath = '/home/hatoo/.config/nvim/settings.json'
let g:LanguageClient_loadSettings = 1
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
" let g:LanguageClient_loggingLevel = 'DEBUG'
autocmd BufNewFile *.rs :LanguageClientStop
autocmd BufNewFile *.rs :LanguageClientStart
"" For roxma/nvim-completion-manager
let g:cm_refresh_length = [[1,1], [7,1]]
"" For Shougo/deoplete
let g:deoplete#enable_at_startup=1
let g:deoplete#auto_complete_start_length=1
"" For neomake/neomake
" When writing a buffer.
call neomake#configure#automake('w')
" When writing a buffer, and on normal mode changes (after 750ms).
call neomake#configure#automake('nw', 0)
" When reading a buffer (after 1s), and when writing.
call neomake#configure#automake('rw', 0)
let g:neomake_rust_enabled_makers = ['rustc']
"" For Shougo/neosnippet
let g:neosnippet#snippets_directory='/mnt/c/Users/hato2/gdrive/snippets'
"" For SirVer/ultisnips
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsSnippetDirectories = ['/mnt/c/Users/hato2/gdrive/snippets']
"" For cohama/lexima
let g:lexima_map_escape=''
"" Keybinds for completion
call lexima#init()
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
" inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
" inoremap <expr> <CR> pumvisible() ? "\<C-y>" : lexima#expand('<LT>CR>', 'i')
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
" imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-j>":"\<c-y>")
" imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
" imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : lexima#expand('<LT>CR>', 'i'))
" inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : lexima#expand('<LT>CR>', 'i'))
inoremap <silent> <expr> <CR> ncm2_ultisnips#expand_or(lexima#expand('<LT>CR>', 'i'), 'n')
"" Keybinds for terminal
tnoremap <silent> <ESC> <C-\><C-n>
function CopyAll()
1,$ yank +
endfunction
function Test()
let command = "abo T win32yank -o | ./" . expand("%:r") . " | head -n 40"
execute command
endfunction
nnoremap [myprefix] <Nop>
nmap <Space> [myprefix]
nmap <expr> [myprefix]y CopyAll()
nmap [myprefix]t :call Test()<CR>
nmap [myprefix]l :LanguageClientStop<CR>:LanguageClientStart<CR>
nmap [myprefix]<space> :RustFmt<CR>
nnoremap [myprefix]b :Denite buffer -mode=normal<CR>
nnoremap [myprefix]f :Denite file -mode=normal<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment