nvim 配置系统

不想你离开。 提交于 2019-12-11 22:42:52

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

/share/nvim/sysinit.vim

ru status.vim
set noswapfile
set mouse=v
set ts=4
set ts=4 sw=4 et 
set shortmess=atI
set fileencodings=utf-8,gbk

set background=light

set rtp+=/opt/bin/ocaml/ocp-indent-vim>

set wildignore+=*.o,*.obj,.git,*.a,*.so,*.lo,*.class,*.beam,deps/*,Mnesia.*,*.hi,vendor/*,copycat/*,target/*,_build/*

set path=.,~/linux/include/

let g:python_host_prog = '/opt/bin/py2/bin/python2'
let g:python2_host_prog = '/opt/bin/py2/bin/python2'
let g:python3_host_prog = '/opt/bin/py3/bin/python3'

let g:ycm_python_binary_path='/opt/bin/py3/bin/python3'
let g:ycm_server_python_interpreter='/opt/bin/py3/bin/python3'
"let g:ycm_python_binary_path='/opt/bin/py2/bin/python2'
"let g:ycm_server_python_interpreter='/opt/bin/py2/bin/python2'
"let g:ycm_global_ycm_extra_conf='~/.vim/click_ycm_extra_conf.py'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'

"let g:ycm_log_level = 'debug'
let g:ycm_extra_conf_globlist = ['~/dev/*','*']

" 随 vim 自启动
let g:indent_guides_enable_on_vim_startup=1
" 从第二层开始可视化显示缩进
let g:indent_guides_start_level=2
" 色块宽度
let g:indent_guides_guide_size=1
" 快捷键 i 开/关缩进可视化
:nmap <silent> <Leader>i <Plug>IndentGuidesToggle

set hidden
let g:racer_cmd = "/usr/local/bin/racer"
"let $RUST_SRC_PATH="/opt/pkg/rust-master/src" 
let $RUST_SRC_PATH="/opt/pkg/rust/src" 



if has("autocmd")
    au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
       \| exe "normal g'\"" | endif
endif

tnoremap <A-h> <C-\><C-n><C-w>h
tnoremap <A-j> <C-\><C-n><C-w>j
tnoremap <A-k> <C-\><C-n><C-w>k
tnoremap <A-l> <C-\><C-n><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l


set statusline=%P%1*\|%*%-3.3n
"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] 
set statusline=%F%m%r%h%w\ [fmt=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] 
"setlocal suffixesadd=.scala

filetype on

"autocmd FileType java set omnifunc=javacomplete#Complete
"autocmd FileType java set completefunc=javacomplete#CompleteParamsInf
autocmd FileType java inoremap <expr><CR> pumvisible()?"\<C-Y>":"<CR>" 
autocmd FileType java inoremap <buffer>  .. <C-X><C-O><C-P><Down>
autocmd FileType java inoremap <expr><CR> pumvisible()?"\<C-Y>":"<CR>"


execute pathogen#infect()

"set background=dark
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

Plugin 'Valloric/YouCompleteMe'

Plugin 'rust-lang/rust.vim'
Plugin 'racer-rust/vim-racer'

""" latexx
Plugin 'lervag/vimtex'
let g:tex_flavor='latex'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}
Plugin 'derekwyatt/vim-scala'
" for Java
Plugin 'artur-shaik/vim-javacomplete2'

Plugin 'vim-syntastic/syntastic'

" for Scala
Plugin 'ensime/ensime-vim'

Plugin 'Shougo/neocomplete'

Plugin 'Shougo/neosnippet'
Plugin 'Shougo/neosnippet-snippets'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

autocmd FileType java set omnifunc=javacomplete#Complete
autocmd FileType java set completefunc=javacomplete#CompleteParamsInf
autocmd FileType java inoremap <expr><CR> pumvisible()?"\<C-Y>":"<CR>"
autocmd FileType java inoremap <buffer>  .. <C-X><C-O><C-P><Down>
autocmd FileType java inoremap <expr><CR> pumvisible()?"\<C-Y>":"<CR>"


"autocmd BufWritePost *.scala :EnTypeCheck
autocmd BufWritePost *.scala silent :EnTypeCheck
"autocmd FileType scala inoremap <localleader>t :EnTypeCheck<CR>
nnoremap <localleader>t :EnType<CR>


function! MyAutoScroll()
    let s:SusLines=5
    "winheight(winnr())
    if nvim_win_get_height(nvim_get_current_win()) <= s:SusLines
        return
    endif

    if winheight(winnr())-winline()>=s:SusLines
        return
    else
        let thisline=winline()
        let inbetween=winheight(winnr())-thisline
        while inbetween <=s:SusLines
            exec "normal! \<c-e>"
            let inbetween=inbetween+1
        endwhile
        echo winheight(winnr()).winline().inbetween. s:SusLines
    endif
endfunction

set scrolloff=5

autocmd! CursorMoved,CursorMovedI * call MyAutoScroll()


nn <silent> <M-.> :call LanguageClient_textDocument_definition()<cr>
nn <silent> <M-,> :call LanguageClient_textDocument_references()<cr>
nn <f2> :call LanguageClient_textDocument_rename()<cr>
nn <leader>ji :Denite documentSymbol<cr>
nn <leader>jI :Denite workspaceSymbol<cr>
"nn <leader>gt :YcmCompleter GoToDefinition<cr>
nnoremap <silent> gt :YcmCompleter GoToDefinition<CR>
"autocmd! CursorMoved,CursorMovedI * :call LanguageClient_textDocument_hover()<cr>
"
"


"let g:ycm_add_preview_to_completeopt = 0
"let g:ycm_show_diagnostics_ui = 0
"let g:ycm_server_log_level = 'info'
"let g:ycm_min_num_identifier_candidate_chars = 2
"let g:ycm_collect_identifiers_from_comments_and_strings = 1
"let g:ycm_complete_in_strings=1
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!