From 37e6bd37c3afeafecbf02b244045ffe724ff05d3 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 19 Mar 2020 15:56:18 +0000 Subject: [PATCH] move all plugin configuration into init.plugins.vim --- init.plugins.vim | 149 +++++++++++++++++++++++++++++++++++++++++++++++ init.vim | 13 +---- vimrc | 46 +++------------ 3 files changed, 161 insertions(+), 47 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index b73f0b2..d387ca8 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -1,3 +1,10 @@ +if empty(glob('~/.config/nvim/autoload/plug.vim'))" + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif +call plug#begin('~/.vim/bundle') + " #vim-hexokinase {{{ " https://github.com/RRethy/vim-hexokinase Plug 'RRethy/vim-hexokinase' @@ -316,6 +323,148 @@ let g:mta_filetypes = { "}}} +" #Netrw {{{ + + let g:netrw_liststyle=3 + let g:netrw_list_hide='^\..*' + let g:netrw_preview = 1 + let g:netrw_winsize = 40 + " let g:netrw_browse_split = 4 + let g:netrw_altfile = 1 + let g:netrw_mousemaps = 0 + + nnoremap nn :call OpenNetrw() + " nnoremap ee :e . + " nnoremap eq :Rex + + function! OpenNetrw() abort "{{{ + Texplore + " setl rnu nu + endfunction + "}}} + + function! CloseNetrw(keep_buffer) abort "{{{ + if a:keep_buffer == 1 + let l:current_buffer = bufnr("%") + tabclose + tabprevious + if bufexists(l:current_buffer) > 0 + execute "buffer" l:current_buffer + endif + else + tabclose + tabprevious + endif + endfunction + "}}} + "}}} +" #Obsession{{{ + " fork of tpope/vim-obsession + Plug 'studio-vx/vim-obsession' + + "}}} +" #undotree {{{ + Plug 'mbbill/undotree' + nnoremap ut :UndotreeToggle + + "}}} +" #tcomment_vim{{{ + " https://github.com/tomtom/tcomment_vim + Plug 'tomtom/tcomment_vim' + +"}}} +" #vim-fzf {{{ +" https://github.com/junegunn/fzf.vim +if executable('fzf') && v:version >= 704 + Plug 'junegunn/fzf.vim' + + nnoremap fg :GFiles + nnoremap ff :Files + nnoremap fH :History + nnoremap ft :Tags + nnoremap fb :Buffers + nnoremap fh :Helptags + " nnoremap fa :Ag + " nnoremap fA :Ag! + + " Ag! gives fullscreen with preview + " command! -bang -nargs=* Ag + " \ call fzf#vim#ag(, + " \ 0 ? fzf#vim#with_preview('up:60%') + " \ : fzf#vim#with_preview('right:50%:hidden', '?'), + " \ 0) + " + " Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag: + command! -bang -nargs=* Rg + \ call fzf#vim#grep( + \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1, + \ 0 ? fzf#vim#with_preview('up:60%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ 0) + + " Files command with preview window + command! -bang -nargs=? -complete=dir Files + \ call fzf#vim#files(, fzf#vim#with_preview(), 0) + + let g:fzf_colors = + \ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Label'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'WildMenu'], + \ 'info': ['fg', 'Comment'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Constant'], + \ 'pointer': ['fg', 'Special'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } +endif + +"}}} +" #polyglot{{{ + " https://github.com/sheerun/vim-polyglot + Plug 'sheerun/vim-polyglot' + + " vue options + let g:vue_disable_pre_processors=0 + " set custom syntax highlighting + augroup fixhighlighting + autocmd! + autocmd BufNewFile,BufRead *.vue syntax sync fromstart + augroup END +"}}} +" #vim-markdown{{{ +" https://github.com/plasticboy/vim-markdown +Plug 'plasticboy/vim-markdown' +let g:vim_markdown_toc_autofit = 1 +let g:vim_markdown_fenced_languages = ['bash=sh'] +"}}} +" #vim-repeat{{{ + " https://github.com/tpope/vim-repeat + Plug 'tpope/vim-repeat' + + "}}} +" #vim-rsi{{{ + "https://github.com/tpope/vim-rsi + Plug 'tpope/vim-rsi' + + "}}} +" #vim-surround{{{ + Plug 'tpope/vim-surround' + + "}}} +" #wakatime{{{ + " https://wakatime.com/vim + Plug 'wakatime/vim-wakatime' + + "}}} + +call plug#end() +runtime macros/matchit.vim +" TODO - try 'coc-tsserver' +call coc#add_extension( 'coc-vetur', 'coc-python', 'coc-phpls', 'coc-json', 'coc-css', 'coc-prettier', 'coc-eslint', 'coc-vimlsp', 'coc-tsserver') diff --git a/init.vim b/init.vim index ff14504..0b83b2e 100644 --- a/init.vim +++ b/init.vim @@ -1,17 +1,8 @@ -set runtimepath^=~/.config/vim runtimepath+=~/.config/vim/after -let &packpath = &runtimepath - - -source ~/.config/vim/vimrc - " set ruby program to global one. Need to investigate if this will cause " problems if I ever use ruby virtual environments or RVM or similar. let g:ruby_host_prog = '~/.gem/ruby/2.6.0/bin/neovim-ruby-host' -" TODO - try 'coc-tsserver' - call coc#add_extension( 'coc-vetur', 'coc-python', 'coc-phpls', 'coc-json', 'coc-css', 'coc-prettier', 'coc-eslint', 'coc-vimlsp', 'coc-tsserver') - -" source ~/.config/nvim/init.statusline.vim +source ~/.config/nvim/init.plugins.vim source ~/.config/nvim/init.tabline.vim set statusline+=\ nvim\ @@ -46,4 +37,6 @@ augroup END "}}} augroup auto_window_settings " }}} auto_window_settings +source ~/.config/nvim/vimrc + " vim: set foldmethod=marker: diff --git a/vimrc b/vimrc index eea3c74..3372d9c 100644 --- a/vimrc +++ b/vimrc @@ -1,41 +1,5 @@ " ● -if &shell =~# 'fish$' - set shell=bash -endif - -" #plugins {{{ - -if has('nvim') - if empty(glob('~/.config/nvim/autoload/plug.vim'))"{{{ - silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC - endif - "}}} - - call plug#begin('~/.vim/bundle') - source ~/.config/nvim/init.plugins.vim - " -else - if empty(glob('~/.vim/autoload/plug.vim'))"{{{ - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC - endif - "}}} - - call plug#begin('~/.config/nvim/bundle') - source ~/.config/vim/vimrc.plugins.vim -endif - -source ~/.config/vim/vimrc.plugins.shared -call plug#end() - -runtime macros/matchit.vim - - -"----------------------------------------------------------------------------}}} " #functions {{{ function! MyFoldText() "{{{ @@ -247,7 +211,16 @@ command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hid "}}} "}}} " #settings {{{ + scriptencoding utf-8 +set ttyfast + +set dictionary+=/usr/share/dict/brit-a-z.txt,/usr/share/dict/britcaps.txt +set thesaurus+=/usr/share/dict/mthesaur.txt + +" disable background color erase +" https://sunaku.github.io/vim-256color-bce.html +set t_ut= syntax on set fillchars=stl:\ ,stlnc:\ ,vert:\|,fold:\ @@ -550,7 +523,6 @@ iabbrev ct'' content-type: ''; set statusline+=\ "----------------------------------------------------------------------------}}} -runtime vimrc-overrides