Skip to content

Instantly share code, notes, and snippets.

@hatoo
Last active July 23, 2018 11:26
Show Gist options
  • Select an option

  • Save hatoo/2601af6e39a1d6b5b730d2190e7dcb4a to your computer and use it in GitHub Desktop.

Select an option

Save hatoo/2601af6e39a1d6b5b730d2190e7dcb4a to your computer and use it in GitHub Desktop.

Revisions

  1. hatoo revised this gist Jul 23, 2018. 1 changed file with 76 additions and 11 deletions.
    87 changes: 76 additions & 11 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,42 @@
    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 'roxma/nvim-completion-manager'
    if !has('nvim')
    Plug 'roxma/vim-hug-neovim-rpc'
    endif
    " 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'
    @@ -33,6 +55,7 @@ Plug 'vim-airline/vim-airline-themes'
    "" Testing
    Plug 'Shougo/denite.nvim'
    Plug 'kassio/neoterm'
    Plug 'scrooloose/nerdtree'

    call plug#end()

    @@ -57,6 +80,14 @@ 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
    @@ -71,37 +102,61 @@ let g:AutoPairsMultilineClose=0
    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'
    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', 750)
    call neomake#configure#automake('nw', 0)
    " When reading a buffer (after 1s), and when writing.
    call neomake#configure#automake('rw', 1000)
    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 = ['snippet directory']
    let g:UltiSnipsSnippetDirectories = ['/mnt/c/Users/hato2/gdrive/snippets']

    "" For cohama/lexima
    let g:lexima_map_escape=''
    @@ -111,13 +166,20 @@ 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> <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>
    @@ -127,14 +189,17 @@ function CopyAll()
    endfunction

    function Test()
    let command = "T win32yank -o | ./" . expand("%:r") . " | head -n 40"
    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>
  2. hatoo revised this gist Mar 16, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion init.vim
    Original file line number Diff line number Diff line change
    @@ -127,7 +127,7 @@ function CopyAll()
    endfunction

    function Test()
    let command = "T win32yank -o \\| ./" . expand("%:r") . " \\| head -n 40"
    let command = "T win32yank -o | ./" . expand("%:r") . " | head -n 40"
    execute command
    endfunction

  3. hatoo revised this gist Mar 15, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -72,6 +72,7 @@ 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.
  4. hatoo created this gist Mar 14, 2018.
    139 changes: 139 additions & 0 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,139 @@
    call plug#begin()

    Plug 'rust-lang/rust.vim'

    Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

    Plug 'junegunn/fzf'

    Plug 'roxma/nvim-completion-manager'
    if !has('nvim')
    Plug 'roxma/vim-hug-neovim-rpc'
    endif

    Plug 'SirVer/ultisnips'
    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'

    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:.

    " 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

    "" For autozimu/LanguageClient-neovim
    " Required for operations modifying multiple buffers like rename.
    set hidden
    let g:LanguageClient_serverCommands = {
    \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
    \ }
    nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
    nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
    nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
    "" For roxma/nvim-completion-manager
    let g:cm_refresh_length = [[1,1], [7,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', 750)
    " When reading a buffer (after 1s), and when writing.
    call neomake#configure#automake('rw', 1000)

    let g:neomake_rust_enabled_makers = ['rustc']

    "" For SirVer/ultisnips
    let g:UltiSnipsExpandTrigger="<c-j>"
    let g:UltiSnipsJumpForwardTrigger="<tab>"
    let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
    " let g:UltiSnipsSnippetDirectories = ['snippet directory']

    "" 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> <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)" : lexima#expand('<LT>CR>', 'i'))
    "" Keybinds for terminal
    tnoremap <silent> <ESC> <C-\><C-n>
    function CopyAll()
    1,$ yank +
    endfunction

    function Test()
    let command = "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>
    nnoremap [myprefix]b :Denite buffer -mode=normal<CR>
    nnoremap [myprefix]f :Denite file -mode=normal<CR>