dotfiles/.config/vim/vim_plug

308 lines
8.6 KiB
Text

" vim: filetype=vim
" ==============================
" VIM-Plug - Plugin Manager
" ==============================
" ===== Vim Plugin Directory (Changes required for Windows user)
let $vimplug_bundle='~/.local/share/vim/bundle'
" let $vimplug_bundle='c:\_local\share\vim\bundle'
" ===== List of used plugins
call plug#begin($vimplug_bundle)
" === Highlightings
" --- Syntax highlighting for ps1 (PowerShell)
Plug 'PProvost/vim-ps1'
" --- For sxhkd config file
Plug 'kovetskiy/sxhkd-vim'
" --- For LaTeX
Plug 'lervag/vimtex'
" ======
" --- Goyo, simplified view for vim useful when writing long documents
Plug 'junegunn/goyo.vim'
" --- Line at the bottom of vim, just to make it look nice
Plug 'itchyny/lightline.vim'
" --- Comment a line in one press of a button (or 2 button)
Plug 'tpope/vim-commentary'
" === NERDTree
" --- Navigate through files/folder while in vim
Plug 'preservim/nerdtree'
" --- Icon for nerdtree
Plug 'ryanoasis/vim-devicons'
" --- Tell everyone on discord that you use vim!
" Plug 'hugolgst/vimsence'
" ======
" -- Markdown preview, not really useful since it's only support github's md format.
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
" --- Auto complete with deoplete
" 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
" deoplete source
" if has('win32') || has('win64')
" Plug 'tbodt/deoplete-tabnine', { 'do': 'powershell.exe .\install.ps1' }
" else
" Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' }
" endif
" Plug 'MarcWeber/vim-addon-mw-utils'
" Plug 'tomtom/tlib_vim'
" Plug 'garbas/vim-snipmate'
" Plug 'honza/vim-snippets'
" Plug 'deoplete-plugins/deoplete-jedi'
" --- Auto complete with NCM2 (nvim-completion-manager)
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
" - NCM2 sources
Plug 'ncm2/ncm2-jedi' " python
Plug 'ncm2/ncm2-racer' " rust
" --- Auto complete with DDC
" Plug 'Shougo/ddc.vim'
" Plug 'vim-denops/denops.vim'
" Plug 'neovim/nvim-lspconfig'
" " - DDC sources
" Plug 'Shougo/ddc-around'
" Plug 'Shougo/ddc-nvim-lsp'
" " - DDC filters
" Plug 'Shougo/ddc-matcher_head'
" Plug 'Shougo/ddc-sorter_rank'
" --- Indent visualization
" Plug 'Yggdroot/indentLine'
" --- sqlite
" Plug 'lbrayner/dbext.vim'
" --- Julia support
Plug 'JuliaEditorSupport/julia-vim'
" --- enhanced python highlighting
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
" --- For golang
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" --- linting support
Plug 'dense-analysis/ale'
" --- For rust
Plug 'rust-lang/rust.vim'
Plug 'wakatime/vim-wakatime'
call plug#end()
" ======================
" PlugIns Configuration
" ======================
" --- deoplete
" let g:deoplete#enable_at_startup = 1
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" call deoplete#custom#option('ignore_sources', {'_': ['around', 'buffer']})
" " imap <tab> <Plug>snipMateNextOrTrigger
" " omnifuncs
" augroup omnifuncs
" autocmd!
" autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
" autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" augroup end
" --- NCM2
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
" suppress the annoying 'match x of y', 'The only match' and 'Pattern not
" found' messages
set shortmess+=c
" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead.
inoremap <c-c> <ESC>
" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new
" line.
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" wrap existing omnifunc
" Note that omnifunc does not run in background and may probably block the
" editor. If you don't want to be blocked by omnifunc too often, you could
" add 180ms delay before the omni wrapper:
" 'on_complete': ['ncm2#on_complete#delay', 180,
" \ 'ncm2#on_complete#omni', 'csscomplete#CompleteCSS'],
au User Ncm2Plugin call ncm2#register_source({
\ 'name' : 'css',
\ 'priority': 9,
\ 'subscope_enable': 1,
\ 'scope': ['css','scss'],
\ 'mark': 'css',
\ 'word_pattern': '[\w\-]+',
\ 'complete_pattern': ':\s*',
\ 'on_complete': ['ncm2#on_complete#omni', 'csscomplete#CompleteCSS'],
\ })
" --- NERDTree
let NERDTreeShowHidden=1
let NERDTreeMinimalUI = 1
" --- Snippet
" let g:UltiSnipsExpandTrigger="<C-Tab>"
" let g:UltiSnipsJumpForwardTrigger="<C-Tab>"
" let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
" let g:UltiSnipsEditSplit="vertical"
" --- lightline
set laststatus=2
let g:lightline = {
\'colorscheme': 'zi',
\'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'fugitive', 'readonly', 'filename', 'modified' ]
\ ],
\ 'right': [
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype', ]
\ ]
\},
\'component': {
\ 'lineinfo': ' %2l:%-2v%<',
\ 'percent': '☰ %2p%%',
\},
\'component_function': {
\ 'gitbranch': 'FugitiveHead',
\ 'fugitive': 'LightlineFugitive',
\ 'filename': 'LightlineFilename'
\},
\ }
set noshowmode
" function for lightline
function! LightlineFugitive()
if &ft !~? 'vimfiler' && exists('*FugitiveHead')
return FugitiveHead()
endif
return ''
endfunction
function! LightlineFilename()
let root = fnamemodify(get(b:, 'git_dir'), ':h')
let path = expand('%:p')
if path[:len(root)-1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
" no lightline on nerdtree
augroup filetype_nerdtree
au!
au FileType nerdtree call s:disable_lightline_on_nerdtree()
au WinEnter,BufWinEnter,TabEnter * call s:disable_lightline_on_nerdtree()
augroup END
fu s:disable_lightline_on_nerdtree() abort
let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1
call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')})
endfu
" --- Custom comments
autocmd FileType xdefaults setlocal commentstring=!\ %s
" --- Indent visualization
let g:indentLine_setColors = 0
let g:indentLine_leadingSpaceEnabled = 1
let g:indentLine_leadingSpaceChar = '·'
hi Conceal ctermfg=0 ctermbg=NONE
" --- Python highlighting
let g:python_highlight_all = 1
" --- DDC
" " Customize global settings
" " Use around source.
" " https://github.com/Shougo/ddc-around
" call ddc#custom#patch_global('sources', ['around', 'nvimlsp'])
" " Use matcher_head and sorter_rank.
" " https://github.com/Shougo/ddc-matcher_head
" " https://github.com/Shougo/ddc-sorter_rank
" call ddc#custom#patch_global('sourceOptions', {
" \ '_': {
" \ 'matchers': ['matcher_head'],
" \ 'sorters': ['sorter_rank']},
" \ })
" " Change source options
" call ddc#custom#patch_global('sourceOptions', {
" \ 'around': {'mark': 'A'},
" \ 'nvimlsp': { 'mark': 'lsp', 'forceCompletionPattern': '\.|:|->' },
" \ })
" call ddc#custom#patch_global('sourceParams', {
" \ 'around': {'maxSize': 500},
" \ 'nvimlsp': { 'kindLabels': { 'Class': 'c' } },
" \ })
" " Customize settings on a filetype
" call ddc#custom#patch_filetype(['rust'], 'sources', ['around', 'nvimlsp'])
" call ddc#custom#patch_filetype(['c', 'cpp'], 'sources', ['around', 'clangd'])
" call ddc#custom#patch_filetype(['c', 'cpp'], 'sourceOptions', {
" \ 'clangd': {'mark': 'C'},
" \ })
" call ddc#custom#patch_filetype('markdown', 'sourceParams', {
" \ 'around': {'maxSize': 100},
" \ })
" " Mappings
" " <TAB>: completion.
" inoremap <silent><expr> <TAB>
" \ pumvisible() ? '<C-n>' :
" \ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
" \ '<TAB>' : ddc#manual_complete()
" " <S-TAB>: completion back.
" inoremap <expr><S-TAB> pumvisible() ? '<C-p>' : '<C-h>'
" " Use ddc.
" call ddc#enable()
" --- nvim-lsp
" lua << EOF
" require'lspconfig'.pyright.setup{}
" local nvim_lsp = require'lspconfig'
" nvim_lsp.rust_analyzer.setup({
" settings = {
" ["rust-analyzer"] = {
" assist = {
" importGranularity = "module",
" importPrefix = "by_self",
" },
" cargo = {
" loadOutDirsFromCheck = true
" },
" procMacro = {
" enable = true
" },
" }
" }
" })
" EOF