diff --git a/.gitignore b/.gitignore index 04f0878..acc07f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ temp_dirs +vimrcs/.secrets.vim +vimrcs/plugins-config/snapshots/ +tags +Session.vim diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3476b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,98 @@ +FROM ubuntu:16.04 +MAINTAINER "https://github.com/zigius" + +SHELL ["/bin/bash", "-c"] +RUN \ + + # set locale + locale-gen en_US.UTF-8 && \ + dpkg-reconfigure locales && \ + + # install ubuntu stuff + sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ + mkdir -p /var/run/sshd && \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y make gcc g++ automake autoconf libc6-dev build-essential libtool openssl libssl-dev libxslt-dev libxml2-dev && \ + apt-get install -y gfortran libopenblas-dev liblapack-dev python-dev && \ + apt-get install -y libsqlite3-dev libbz2-dev libxslt1-dev libffi-dev ncurses-dev cmake && \ + apt-get install -y software-properties-common byobu curl git htop man unzip vim wget supervisor vim-gnome xclip xsel && \ + apt-get install -y nodejs npm silversearcher-ag && \ + rm -rf /var/lib/apt/lists/* + +RUN \ + + # install pyenv + git clone git://github.com/yyuu/pyenv.git /root/.pyenv && \ + echo 'after first clone' && \ + git clone https://github.com/yyuu/pyenv-virtualenv.git /root/.pyenv/plugins/pyenv-virtualenv && \ + echo 'after second clone' && \ + echo -e '\n\n# pyenv' >> /root/.bashrc && \ + echo 'export PYENV_ROOT="/root/.pyenv"' >> /root/.bashrc && \ + echo 'export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:/usr/texbin:$PATH"' >> /root/.bashrc && \ + echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \ + echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.bashrc + +# create pyenv environments. Interactive shell because we need the bashrc +RUN ["/bin/bash", "-ic", "pyenv install 3.4.1"] +RUN ["/bin/bash", "-ic", "pyenv install 2.7.9"] +RUN ["/bin/bash", "-ic", "pyenv rehash"] +RUN ["/bin/bash", "-ic", "pyenv virtualenv 3.4.1 neovim3"] +RUN ["/bin/bash", "-ic", "pyenv virtualenv 2.7.9 neovim2"] +RUN ["/bin/bash", "-ic", "pyenv activate neovim3; pip install neovim"] +RUN ["/bin/bash", "-ic", "pyenv activate neovim2; pip install neovim"] + +RUN \ + + # Install neovim + add-apt-repository -y ppa:neovim-ppa/unstable && \ + apt-get update && \ + apt-get install -y neovim && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN \ + + # download vim plug + curl -fLo /root/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim && \ + + # install custom configurations + git clone https://github.com/zigius/vimrc.git /root/.vim_runtime3 && \ + sh /root/.vim_runtime3/install.sh + +RUN \ + + # make directories and symlinks for neovim + mkdir /root/.config && \ + ln -s /root/.vim /root/.config/nvim && \ + ln -s /root/.vimrc /root/.config/nvim/init.vim + +# Install plugins +RUN vim +PlugInstall +qall + +# Set environment variables. +ENV HOME /root + +# for ultisnips or ycm +ENV PYTHON_CONFIGURE_OPTS "--enable-shared" + +# Define default command. +CMD ["bash"] + +# Crucial instructions for mac users to enable clipboard tunneling: +# 1. make sure XQuartz is installed and running +# 2. make sure allow connections in xquartz is enabled. +# 3. make sure to open xquartz app from iterm after xquartz is opened using : open -a XQuartz +# 4. get your display ip using the following command (for multiple displays the solution is currently not tested): +# IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') xhost + $IP + +# to automatically add ip to xhost add the following lines to your bashrc file +# export IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') +# xhost + $IP + +# Based on the following links: +# https://forums.docker.com/t/how-to-run-gui-apps-in-containiers-in-osx-docker-for-mac/17797/7 +# https://fredrikaverpil.github.io/2016/07/31/docker-for-mac-and-gui-applications/ + +# 5. docker run with the following command : +# docker run -it -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix neovimtest:one bash diff --git a/install.sh b/install.sh index eff1091..327f696 100644 --- a/install.sh +++ b/install.sh @@ -2,40 +2,54 @@ cd ~/.vim_runtime3 echo ' source ~/.vim_runtime3/plugins-list.vim - source ~/.vim_runtime3/vimrcs/basic/basic.vim -source ~/.vim_runtime3/vimrcs/basic/buffers.vim -source ~/.vim_runtime3/vimrcs/basic/folds.vim -source ~/.vim_runtime3/vimrcs/basic/jumps.vim -source ~/.vim_runtime3/vimrcs/basic/tabs.vim -source ~/.vim_runtime3/vimrcs/basic/windows.vim - -source ~/.vim_runtime3/vimrcs/extended/gui.vim -source ~/.vim_runtime3/vimrcs/extended/abbreviations.vim source ~/.vim_runtime3/vimrcs/extended/undo.vim -source ~/.vim_runtime3/vimrcs/filetypes/coffee.vim -source ~/.vim_runtime3/vimrcs/filetypes/javascript.vim -source ~/.vim_runtime3/vimrcs/filetypes/json.vim -source ~/.vim_runtime3/vimrcs/filetypes/python.vim -source ~/.vim_runtime3/vimrcs/filetypes/go.vim -source ~/.vim_runtime3/vimrcs/plugins-config/plugins-config.vim +" source ~/.vim_runtime3/vimrcs/extended/abbreviations.vim + +" source ~/.vim_runtime3/vimrcs/filetypes/javascript.vim +" source ~/.vim_runtime3/vimrcs/filetypes/json.vim +" source ~/.vim_runtime3/vimrcs/filetypes/python.vim +" source ~/.vim_runtime3/vimrcs/filetypes/go.vim +" source ~/.vim_runtime3/vimrcs/filetypes/clojure.vim + +" source ~/.vim_runtime3/vimrcs/plugins-config/plugins-config.vim if has('"'"'nvim'"'"') source ~/.vim_runtime3/vimrcs/neovim/neovim.vim endif -source ~/.vim_runtime3/vimrcs/opinionated/colorscheme.vim -source ~/.vim_runtime3/vimrcs/opinionated/d-is-for-delete.vim -source ~/.vim_runtime3/vimrcs/opinionated/escape-key.vim -source ~/.vim_runtime3/vimrcs/opinionated/yank.vim -source ~/.vim_runtime3/vimrcs/opinionated/experiment.vim - +" source ~/.vim_runtime3/vimrcs/opinionated/experiment.vim +try + " source ~/.vim_runtime3/vimrcs/my-configs.vim + source ~/.vim_runtime3/vimrcs/python.vim + source ~/.vim_runtime3/vimrcs/basic/buffers.vim + source ~/.vim_runtime3/vimrcs/extended/move-line.vim + source ~/.vim_runtime3/vimrcs/basic/windows.vim + source ~/.vim_runtime3/vimrcs/.secrets.vim + source ~/.vim_runtime3/vimrcs/basic/folds.vim + source ~/.vim_runtime3/vimrcs/opinionated/d-is-for-delete.vim + source ~/.vim_runtime3/vimrcs/opinionated/escape-key.vim + source ~/.vim_runtime3/vimrcs/opinionated/yank.vim + source ~/.vim_runtime3/vimrcs/opinionated/terminal.vim + source ~/.vim_runtime3/vimrcs/opinionated/macro.vim + + " plugins + source ~/.vim_runtime3/vimrcs/plugins-config/nerdtree.vim + source ~/.vim_runtime3/vimrcs/plugins-config/fzf.vim + source ~/.vim_runtime3/vimrcs/plugins-config/fugitive.vim + source ~/.vim_runtime3/vimrcs/plugins-config/ack.vim + source ~/.vim_runtime3/vimrcs/plugins-config/sneak.vim + source ~/.vim_runtime3/vimrcs/plugins-config/rooter.vim + source ~/.vim_runtime3/vimrcs/plugins-config/autosave.vim + source ~/.vim_runtime3/vimrcs/plugins-config/vimwiki.vim + + source ~/.vim_runtime3/vimrcs/opinionated/colorscheme.vim + " source ~/.vim_runtime3/vimrcs/onedark.vim + " source ~/.vim_runtime3/vimrcs/monokai.vim +catch +endtry ' > ~/.vimrc echo "Installed vimrc 3.0 successfully!" - - - - diff --git a/plugins-list.vim b/plugins-list.vim index 53f143b..b999132 100644 --- a/plugins-list.vim +++ b/plugins-list.vim @@ -1,49 +1,162 @@ -function! BuildYCM(info) - " info is a dictionary with 3 fields - " - name: name of the plugin - " - status: 'installed', 'updated', or 'unchanged' - " - force: set on PlugInstall! or PlugUpdate! - if a:info.status == 'installed' || a:info.force - !./install.py --tern-completer - endif -endfunction - call plug#begin('~/.vim/plugged') -Plug 'mileszs/ack.vim', { 'tag': '1.0.9' } -Plug 'jasoncodes/ctrlp-modified.vim', { 'tag': 'v0.1.0' } | Plug 'kien/ctrlp.vim', { 'tag': '1.79' } -Plug 'scrooloose/nerdtree', { 'tag': '5.0.0' } | Plug 'jistr/vim-nerdtree-tabs', { 'tag': 'v1.4.6'} | Plug 'Xuyuanp/nerdtree-git-plugin', { 'commit': 'e71e62f' } -Plug 'junegunn/goyo.vim', { 'tag': '1.6.0' } -Plug 'scrooloose/syntastic', { 'commit': '0bedeb9' } -Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') } - -Plug 'majutsushi/tagbar', { 'tag': 'v2.6.1' } -Plug 'tomtom/tcomment_vim', { 'tag': 'v201' } -Plug 'tpope/vim-abolish', { 'tag': 'v1.1' } -Plug 'vim-airline/vim-airline', { 'tag': 'v0.8' } | Plug 'vim-airline/vim-airline-themes', { 'commit': '020b843' } -Plug 'tpope/vim-fugitive', { 'tag': 'v2.2' } -Plug 'airblade/vim-gitgutter', { 'commit': '26c6b54' } -Plug 'tpope/vim-obsession', { 'commit': 'ad1ef9a'} -Plug 'tpope/vim-repeat', { 'tag': 'v1.1'} -Plug 'airblade/vim-rooter', { 'commit': '70c105c'} -Plug 'tpope/vim-surround', { 'tag': 'v2.1'} -Plug 'amix/vim-zenroom2', { 'commit': '948734e'} -Plug 'gabrielelana/vim-markdown' - -" languages plugins -Plug 'moll/vim-node', { 'tag': 'v0.8.1'} -Plug 'pangloss/vim-javascript', { 'tag': 'v1.1.3'} -Plug 'othree/yajs.vim', { 'tag': '1.6'} -Plug 'mattn/emmet-vim', { 'commit': 'f4b097a' } -Plug 'groenewege/vim-less', { 'commit': '6e818d5'} -Plug 'nvie/vim-flake8', { 'tag': '1.6' } -Plug 'chase/vim-ansible-yaml', { 'tag': 'v1.0' } -Plug 'fatih/vim-go', { 'tag': 'v1.8'} - -" snippets plugins -Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets', { 'tag': '1.0.0' } - -" color scheme -Plug 'chriskempson/vim-tomorrow-theme', { 'commit': 'f45a2ca' } +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +Plug 'junegunn/fzf.vim' +Plug 'ojroques/nvim-lspfuzzy' +Plug 'preservim/nerdtree' +Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'tomtom/tcomment_vim' +Plug 'tpope/vim-fugitive' +Plug 'airblade/vim-rooter' +Plug 'mileszs/ack.vim' +Plug 'sheerun/vim-polyglot' +Plug 'haya14busa/is.vim' + +Plug 'tpope/vim-unimpaired' +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-surround' +Plug 'justinmk/vim-sneak' +Plug 'zhou13/vim-easyescape' +Plug 'diepm/vim-rest-console' +Plug 'vimwiki/vimwiki' +Plug 'justinmk/vim-gtfo' + +" Uncomment +" Plug 'junegunn/gv.vim' +" Plug 'jesseleite/vim-agriculture' +" Plug 'lambdalisue/fern.vim' +" Plug 'lambdalisue/nerdfont.vim' +" Plug 'lambdalisue/fern-renderer-nerdfont.vim' +" +" Plug 'editorconfig/editorconfig-vim' +" Plug 'majutsushi/tagbar' +Plug 'tpope/vim-abolish' +" Plug 'vim-airline/vim-airline'| Plug 'vim-airline/vim-airline-themes' +" Plug 'tpope/vim-rhubarb' +" Plug 'airblade/vim-gitgutter' +" Plug 'airblade/vim-rooter' +" Plug 'tpope/vim-surround' +" Plug 'tommcdo/vim-exchange' +" Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } +" Plug 'kien/rainbow_parentheses.vim' +" Plug 'justinmk/vim-sneak' +" Plug 'Raimondi/delimitMate' +" Uncomment + + +" requires nvim 0.5.0 +if has('nvim-0.5') + Plug 'neovim/nvim-lspconfig' + Plug 'nvim-lua/completion-nvim' + Plug 'aca/completion-tabnine', { 'do': 'version=3.1.9 ./install.sh' } + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + Plug 'npxbr/glow.nvim', {'do': ':GlowInstall'} + Plug 'norcalli/nvim-colorizer.lua' + Plug 'nvim-lua/popup.nvim' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' +endif + + +" Plug 'neovim/nvim-lspconfig', {'on': 'LspInfo'} +" Plug 'nvim-lua/completion-nvim', {'on': 'CompletionToggle'} +" Plug 'nvim-treesitter/nvim-treesitter', { 'on': 'TSConfigInfo', 'do': ':TSUpdate'} +" Plug 'npxbr/glow.nvim', {'on': 'Glow', 'do': ':GlowInstall'} +" Plug 'norcalli/nvim-colorizer.lua', {'on': 'ColorizerToggle'} + +" Language syntax plugins +" ********** +" ********** +" Plug 'davidhalter/jedi-vim' +" Uncomment +" Plug 'lambdalisue/vim-pyenv' +" Plug 'towolf/vim-helm' +" Uncomment +" Language server before coc +" ********** +" ********** +" Plug 'autozimu/LanguageClient-neovim', { +" \ 'branch': 'next', +" \ 'do': 'bash install.sh', +" \ } +" +" Plug 'Shougo/denite.nvim' +" +" " (Optional) Completion integration with deoplete. +" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" " (Optional) Completion integration with nvim-completion-manager. +" Plug 'roxma/nvim-completion-manager' +" +" " (Optional) Showing function signature and inline doc. +" Plug 'Shougo/echodoc.vim' +" Language server +" ********** +" ********** + + +""""""""""""""""""" +" test coc.nvim " +""""""""""""""""""" +" Uncomment +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'antoinemadec/coc-fzf' +" Uncomment + +" Highlighting +" ********** +" ********** +" Uncomment +" Plug 'xtal8/traces.vim' +" Plug 'haya14busa/incsearch.vim' +" Uncomment + +" Themes +" ********** +" ********** +" Uncomment +" Plug 'sickill/vim-monokai' +" Plug 'patstockwell/vim-monokai-tasty' +Plug 'joshdick/onedark.vim' +Plug 'christianchiarulli/nvcode-color-schemes.vim' +" Uncomment + + +" Last plugins +" ********** +" ********** +" Plug 'ryanoasis/vim-devicons' +" unused plugins +" ********** +" ********** +" Plug '907th/vim-auto-save' +" Plug 'nvie/vim-flake8' +" Plug 'ervandew/supertab' +" Plug 'benmills/vimux' +" Plug 'godlygeek/tabular' +" Plug 'mattn/emmet-vim' +" Plug 'tpope/vim-obsession' +" Plug 'Yggdroot/indentLine' +" Plug 'dyng/ctrlsf.vim' +" Plug 'AndrewRadev/ginitpull.vim' +" Plug 'zigius/vim-auto-save-git-hook' +" Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' } +" Plug 'tommcdo/vim-lion' +" Plug 'gcmt/wildfire.vim' +" Plug 'terryma/vim-multiple-cursors' +" Plug 'fatih/vim-go' +" Plug 'ternjs/tern_for_vim' +" Plug 'styled-components/vim-styled-components', { 'branch': 'main' } +" Plug 'christoomey/vim-tmux-navigator' +" Plug 'AndrewRadev/splitjoin.vim' +" Plug 'matze/vim-move' +" Plug 'AndrewRadev/sideways.vim' +" Plug 'moll/vim-node' +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" Plug 'mxw/vim-jsx' +" Plug 'pangloss/vim-javascript' +" Plug 'othree/yajs.vim' +" Plug 'jistr/vim-nerdtree-tabs' +" Plug 'w0rp/ale' +" Plug 'pbogut/fzf-mru.vim' call plug#end() diff --git a/vimrcs/basic/basic.vim b/vimrcs/basic/basic.vim index 26d4a9a..51fc97e 100644 --- a/vimrcs/basic/basic.vim +++ b/vimrcs/basic/basic.vim @@ -2,20 +2,23 @@ " Based on Amir Salihefendic's ultimate virmc project " https://github.com/amix/vimrc """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Sets how many lines of history VIM has to remember -set history=500 - +set history=10000 +set shell=zsh\ -l " Enable filetype plugins filetype plugin on filetype indent on " Set to auto read when a file is changed from the outside set autoread +set updatetime=1000 +" neovim slowness +set noshowcmd +set noruler " With a map leader it's possible to do extra key combinations " like w saves the current file let mapleader = "," @@ -32,8 +35,7 @@ map q :q " :W sudo saves the file " (useful for handling the permission-denied error) -command W w !sudo tee % > /dev/null - +command! W w !sudo tee % > /dev/null """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => VIM user interface @@ -57,6 +59,7 @@ if has("win16") || has("win32") else set wildignore+=.git\*,.hg\*,.svn\* endif +set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux "Always show current position set ruler @@ -113,14 +116,7 @@ set foldcolumn=1 " => Colors and Fonts """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable syntax highlighting -syntax enable - -try - colorscheme desert -catch -endtry - -set background=dark +syntax on " Set extra options when running in GUI mode if has("gui_running") @@ -191,15 +187,6 @@ map ? " Disable highlight when is pressed map :noh -" Let 'tl' toggle between this and the last accessed tab -let g:lasttab = 1 -nmap tl :exe "tabn ".g:lasttab -au TabLeave * let g:lasttab = tabpagenr() - - -" Opens a new tab with the current buffer's path -" Super useful when editing files in the same directory -map te :tabedit =expand("%:p:h")/ " Switch CWD to the directory of the open buffer map cd :cd %:p:h:pwd @@ -210,44 +197,27 @@ try set stal=2 catch endtry - """""""""""""""""""""""""""""" + " => Status line """""""""""""""""""""""""""""" " Always show the status line set laststatus=2 " Format the status line -set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l - - +" Not used when airline plugin is enabled +" set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l +" set statusline^=%{coc#status()} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " => Editing mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Remap VIM 0 to first non-blank character -map 0 ^ - -" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac -nmap mz:m+`z -nmap mz:m-2`z -vmap :m'>+`mzgv`yo`z -vmap :m'<-2`>my` - nmap - vmap - vmap -endif +noremap 0 ^ +noremap ^ 0 -" Delete trailing white space on save, useful for Python and CoffeeScript ;) -func! DeleteTrailingWS() - exe "normal mz" - %s/\s\+$//ge - exe "normal `z" -endfunc -autocmd BufWrite *.py :call DeleteTrailingWS() -autocmd BufWrite *.coffee :call DeleteTrailingWS() +" split line at cursor when pressing capital K. replaces man help for word under cursor +nnoremap K i """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Ag searching and cope displaying @@ -257,22 +227,13 @@ autocmd BufWrite *.coffee :call DeleteTrailingWS() vnoremap gv :call VisualSelection('gv', '') " Open Ag and put the cursor in the right position -map g :Ack! +nmap g :Ack! +vnoremap g :call VisualSelection('gv', '') " When you press r you can search and replace the selected text vnoremap r :call VisualSelection('replace', '') +vnoremap f :call VisualSelection('f', '') -" Do :help cope if you are unsure what cope is. It's super useful! -" -" When you search with Ag, display your results in cope by doing: -" cc -" -" To go to the next search result do: -" n -" -" To go to the previous search results do: -" p -" map cc :botright cope map co ggVGy:tabnew:set syntax=qfpgg map n :cn @@ -283,38 +244,32 @@ map p :cp " => Spell checking """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Pressing ,ss will toggle and untoggle spell checking -map ss :setlocal spell! +" map ss :setlocal spell! " Shortcuts using -map sn ]s -map sp [s -map sa zg -map s? z= +" map sn ]s +" map sp [s +" map sa zg +" map s? z= """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Misc """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remove the Windows ^M - when the encodings gets messed up -noremap m mmHmt:%s///ge'tzt'm - " Quickly open a buffer for scribble map bs :e ~/buffer +map bh :e ~/.zsh_history " Quickly open a markdown buffer for scribble map bm :e ~/buffer.md -" Toggle paste mode on and off -map pp :setlocal paste! - - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Helper functions """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" function! CmdLine(str) exe "menu Foo.Bar :" . a:str emenu Foo.Bar - unmenu Foo + unmenu foo endfunction function! VisualSelection(direction, extra_filter) range @@ -327,7 +282,7 @@ function! VisualSelection(direction, extra_filter) range if a:direction == 'b' execute "normal ?" . l:pattern . "^M" elseif a:direction == 'gv' - call CmdLine("Ag \"" . l:pattern . "\" " ) + call CmdLine("Ack! \"" . l:pattern . "\" " ) elseif a:direction == 'replace' call CmdLine("%s" . '/'. l:pattern . '/') elseif a:direction == 'f' @@ -338,7 +293,6 @@ function! VisualSelection(direction, extra_filter) range let @" = l:saved_reg endfunction - " Returns true if paste mode is enabled function! HasPaste() if &paste @@ -346,3 +300,16 @@ function! HasPaste() endif return '' endfunction + +if has('macunix') + function! OpenURLUnderCursor() + let s:uri = matchstr(getline('.'), '[a-z]*:\/\/[^ >,;()]*') + let s:uri = shellescape(s:uri, 1) + if s:uri != '' + silent exec "!open '".s:uri."'" + :redraw! + endif + endfunction + nnoremap gxm :call OpenURLUnderCursor() +endif + diff --git a/vimrcs/basic/buffers.vim b/vimrcs/basic/buffers.vim index 774885b..ed12ee4 100644 --- a/vimrcs/basic/buffers.vim +++ b/vimrcs/basic/buffers.vim @@ -29,14 +29,3 @@ function! BufcloseCloseIt() execute("bdelete! ".l:currentBufNum) endif endfunction - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Close all empty buffers -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -command! CleanEmptyBuffers call s:CleanEmptyBuffers() -function! s:CleanEmptyBuffers() - let buffers = filter(range(0, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val)<0') - if !empty(buffers) - exe 'bw '.join(buffers, ' ') - endif -endfunction diff --git a/vimrcs/basic/folds.vim b/vimrcs/basic/folds.vim index 9939b19..c74c52d 100644 --- a/vimrcs/basic/folds.vim +++ b/vimrcs/basic/folds.vim @@ -1,2 +1,5 @@ -set foldmethod=syntax -set foldlevelstart=0 +set nofoldenable +" set foldmethod=syntax +" set foldlevelstart=0 +set foldlevelstart=99 +set foldlevel=99 diff --git a/vimrcs/basic/jumps.vim b/vimrcs/basic/jumps.vim deleted file mode 100644 index da315f3..0000000 --- a/vimrcs/basic/jumps.vim +++ /dev/null @@ -1,13 +0,0 @@ -function! GotoJump() - jumps - let j = input("Please select your jump: ") - if j != '' - let pattern = '\v\c^\+' - if j =~ pattern - let j = substitute(j, pattern, '', 'g') - execute "normal " . j . "\" - else - execute "normal " . j . "\" - endif - endif -endfunction diff --git a/vimrcs/basic/tabs.vim b/vimrcs/basic/tabs.vim deleted file mode 100644 index d2c65d9..0000000 --- a/vimrcs/basic/tabs.vim +++ /dev/null @@ -1,7 +0,0 @@ -" Useful mappings for managing tabs -map tn :tabnew -map to :tabonly -map tc :tabclose -map tm :tabmove -map t :tabnext - diff --git a/vimrcs/colorschemes/colorbuddy.vim b/vimrcs/colorschemes/colorbuddy.vim new file mode 100644 index 0000000..176d78c --- /dev/null +++ b/vimrcs/colorschemes/colorbuddy.vim @@ -0,0 +1,2 @@ +lua require'colorizer'.setup() + diff --git a/vimrcs/colorschemes/colorscheme.vim b/vimrcs/colorschemes/colorscheme.vim new file mode 100644 index 0000000..e0d617f --- /dev/null +++ b/vimrcs/colorschemes/colorscheme.vim @@ -0,0 +1,23 @@ +if (has("termguicolors")) + set termguicolors +endif + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" use tommorow Colorscheme +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" if has("gui_running") +" silent! colorscheme Tomorrow +" else +" set background=light +" silent! colorscheme Tomorrow +" endif +" + + +" currently set to onedark +" +" let g:airline_theme='onedark' +let g:onedark_terminal_italics = 1 +let g:onedark_hide_endofbuffer = 1 +colorscheme onedark diff --git a/vimrcs/colorschemes/nvcode.vim b/vimrcs/colorschemes/nvcode.vim new file mode 100644 index 0000000..5015d17 --- /dev/null +++ b/vimrcs/colorschemes/nvcode.vim @@ -0,0 +1,90 @@ +lua << EOF +require'nvim-treesitter.configs'.setup { + ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + disable = { "c", "rust" }, -- list of language that will be disabled + }, +} +EOF + +" configure nvcode-color-schemes +let g:nvcode_termcolors=256 + +syntax on + +" checks if your terminal has 24-bit color support +if (has("termguicolors")) + set termguicolors + hi LineNr ctermbg=NONE guibg=NONE +endif + +colorscheme nvcode " Or whatever colorscheme you make + +" Misc +highlight TSError guifg=#F44747 +highlight TSPunctDelimiter guifg=#ABB2BF +highlight TSPunctBracket guifg=#ABB2BF +highlight TSPunctSpecial guifg=#ABB2BF + +" Constants +highlight TSConstant guifg=#DCDCAA +highlight TSConstBuiltin guifg=#569CD6 +" Not sure about this guy +highlight TSConstMacro guifg=#4EC9B0 +highlight TSString guifg=#CE9178 +highlight TSStringRegex guifg=#CE9178 +highlight TSString guifg=#CE9178 +highlight TSStringEscape guifg=#D7BA7D +highlight TSCharacter guifg=#CE9178 +highlight TSNumber guifg=#B5CEA8 +highlight TSBoolean guifg=#569CD6 +highlight TSFloat guifg=#B5CEA8 +highlight TSAnnotation guifg=#DCDCAA +highlight TSAttribute guifg=#FF00FF +highlight TSNamespace guifg=#FF00FF + + +" Functions +" highlight TSFuncBuiltin guifg=#4EC9B0 +highlight TSFuncBuiltin guifg=#DCDCAA +highlight TSFunction guifg=#DCDCAA +highlight TSFuncMacro guifg=#DCDCAA +highlight TSParameter guifg=#9CDCFE +highlight TSParameterReference guifg=#9CDCFE +highlight TSMethod guifg=#DCDCAA +highlight TSField guifg=#9CDCFE +highlight TSProperty guifg=#9CDCFE +highlight TSConstructor guifg=#4EC9B0 + +" Keywords +highlight TSConditional guifg=#C586C0 +highlight TSRepeat guifg=#C586C0 +highlight TSLabel guifg=#FF00FF +" Does not work for yield and return they should be diff then class and def +highlight TSKeyword guifg=#569CD6 +highlight TSKeywordFunction guifg=#FF00FF +highlight TSKeywordOperator guifg=#569CD6 +highlight TSOperator guifg=#ABB2BF +highlight TSException guifg=#C586C0 +highlight TSType guifg=#4EC9B0 +highlight TSTypeBuiltin guifg=#FF00FF +highlight TSStructure guifg=#FF00FF +highlight TSInclude guifg=#C586C0 + +" Variable +highlight TSVariable guifg=#9CDCFE +highlight TSVariableBuiltin guifg=#9CDCFE + +" Text +highlight TSText guifg=#FF00FF +highlight TSStrong guifg=#FF00FF +highlight TSEmphasis guifg=#FF00FF +highlight TSUnderline guifg=#FF00FF +highlight TSTitle guifg=#FF00FF +highlight TSLiteral guifg=#FF00FF +highlight TSURI guifg=#FF00FF + +" Tags +highlight TSTag guifg=#569CD6 +highlight TSTagDelimiter guifg=#5C6370 diff --git a/vimrcs/extended/gui.vim b/vimrcs/extended/gui.vim deleted file mode 100644 index ed0ad20..0000000 --- a/vimrcs/extended/gui.vim +++ /dev/null @@ -1,25 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => GUI related -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Set font according to system -if has("mac") || has("macunix") - set gfn=Source\ Code\ Pro:h15,Menlo:h15 -elseif has("win16") || has("win32") - set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 -elseif has("linux") - set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 -elseif has("unix") - set gfn=Monospace\ 11 -endif - -" Open MacVim in fullscreen mode -if has("gui_macvim") - set fuoptions=maxvert,maxhorz - au GUIEnter * set fullscreen -endif - -" Disable scrollbars (real hackers don't use scrollbars for navigation!) -set guioptions-=r -set guioptions-=R -set guioptions-=l -set guioptions-=L diff --git a/vimrcs/extended/move-line.vim b/vimrcs/extended/move-line.vim new file mode 100644 index 0000000..d04f144 --- /dev/null +++ b/vimrcs/extended/move-line.vim @@ -0,0 +1,25 @@ +" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac +" nmap mz:m+`z +" nmap mz:m-2`z +" vmap :m'>+`mzgv`yo`z +" vmap :m'<-2`>my`== + nnoremap ˚ :m .-2== + inoremap ∆ :m .+1==gi + inoremap ˚ :m .-2==gi + vnoremap ∆ :m '>+1gv=gv + vnoremap ˚ :m '<-2gv=gv + + nnoremap j :m .+1== + nnoremap k :m .-2== + inoremap j :m .+1==gi + inoremap k :m .-2==gi + vnoremap j :m '>+1gv=gv + vnoremap k :m '<-2gv=gv +endif + diff --git a/vimrcs/extended/vimrc-reload.vim~ b/vimrcs/extended/vimrc-reload.vim~ deleted file mode 100644 index 251fde5..0000000 --- a/vimrcs/extended/vimrc-reload.vim~ +++ /dev/null @@ -1,5 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Fast editing and reloading of vimrc configs -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -map e :e! ~/.vim_runtime3/vimrcs/opinionated/my_configs.vim -autocmd! bufwritepost vimrc source ~/.vim_runtime3/opinionated/vimrcs/my_configs.vim diff --git a/vimrcs/filetypes/clojure.vim b/vimrcs/filetypes/clojure.vim new file mode 100644 index 0000000..6de90e9 --- /dev/null +++ b/vimrcs/filetypes/clojure.vim @@ -0,0 +1,27 @@ +" clojure stuff +" let g:rbpt_colorpairs = [ + \ ['brown', 'RoyalBlue3'], + \ ['Darkblue', 'SeaGreen3'], + \ ['darkgray', 'DarkOrchid3'], + \ ['darkgreen', 'firebrick3'], + \ ['darkcyan', 'RoyalBlue3'], + \ ['darkred', 'SeaGreen3'], + \ ['darkmagenta', 'DarkOrchid3'], + \ ['brown', 'firebrick3'], + \ ['gray', 'RoyalBlue3'], + \ ['black', 'SeaGreen3'], + \ ['darkmagenta', 'DarkOrchid3'], + \ ['Darkblue', 'firebrick3'], + \ ['darkgreen', 'RoyalBlue3'], + \ ['darkcyan', 'SeaGreen3'], + \ ['darkred', 'DarkOrchid3'], + \ ['red', 'firebrick3'], + \ ] +" let g:rbpt_max = 16 +" let g:rbpt_loadcmd_toggle = 0 + +" au VimEnter * RainbowParenthesesToggle +" au Syntax * RainbowParenthesesLoadRound +" au Syntax * RainbowParenthesesLoadSquare +" au Syntax * RainbowParenthesesLoadBraces + diff --git a/vimrcs/filetypes/coffee.vim b/vimrcs/filetypes/coffee.vim deleted file mode 100644 index a978ff7..0000000 --- a/vimrcs/filetypes/coffee.vim +++ /dev/null @@ -1,8 +0,0 @@ -function! CoffeeScriptFold() - setl foldmethod=indent - setl foldlevelstart=1 -endfunction -au FileType coffee call CoffeeScriptFold() - -au FileType gitcommit call setpos('.', [0, 1, 1, 0]) - diff --git a/vimrcs/filetypes/javascript.vim b/vimrcs/filetypes/javascript.vim index 8d68f64..7e4e38f 100644 --- a/vimrcs/filetypes/javascript.vim +++ b/vimrcs/filetypes/javascript.vim @@ -1,13 +1,10 @@ au FileType javascript setlocal omnifunc=tern#Complete -" au FileType javascript call JavaScriptFold() au FileType javascript setl fen au FileType javascript setl nocindent -au FileType javascript nnoremap a A; -command! JavaScriptFold call s:JavaScriptFold() -function! s:JavaScriptFold () - function! FoldText() - return substitute(getline(v:foldstart), '{.*', '{...}', '') - endfunction - setl foldtext=FoldText() +" automatically fix js errors using eslint fix flag when calling the eslintfix function +command! EslintFix call s:EslintFix() +function! s:EslintFix () + execute "!" . "eslint" . " " . "--fix". " " . bufname("%") endfunction + diff --git a/vimrcs/filetypes/json.vim b/vimrcs/filetypes/json.vim index a4653ec..9897f1e 100644 --- a/vimrcs/filetypes/json.vim +++ b/vimrcs/filetypes/json.vim @@ -1 +1,4 @@ -command! -range -nargs=0 -bar JsonTool ,!python -m json.tool +command! JsonTool :%!python -m json.tool + +" doesnt work anymore +" command! -range -nargs=0 -bar JsonTool ,!python -m json.tool diff --git a/vimrcs/filetypes/python.vim b/vimrcs/filetypes/python.vim index daf083f..f1285bf 100644 --- a/vimrcs/filetypes/python.vim +++ b/vimrcs/filetypes/python.vim @@ -3,15 +3,3 @@ au FileType python syn keyword pythonDecorator True None False self au BufNewFile,BufRead *.jinja set syntax=htmljinja au BufNewFile,BufRead *.mako set ft=mako - -au FileType python map F :set foldmethod=indent - -au FileType python inoremap $r return -au FileType python inoremap $i import -au FileType python inoremap $p print -au FileType python inoremap $f #--- PH ----------------------------------------------FP2xi -au FileType python map 1 /class -au FileType python map 2 /def -au FileType python map C ?class -au FileType python map D ?def - diff --git a/vimrcs/monokai.vim b/vimrcs/monokai.vim new file mode 100644 index 0000000..8bfaaed --- /dev/null +++ b/vimrcs/monokai.vim @@ -0,0 +1,13 @@ +" override behaviour from plugins config + +" commented on 21.11.19 +" let &t_8f="\[38;2;%lu;%lu;%lum" +" let &t_8b="\[48;2;%lu;%lu;%lum" +" commented on 21.11.19 + +let g:vim_monokai_tasty_italic = 1 +let g:airline_theme='monokai_tasty' +set termguicolors +silent! colorscheme monokai +silent! colorscheme vim-monokai-tasty +colorscheme vim-monokai-tasty diff --git a/vimrcs/my-configs.vim b/vimrcs/my-configs.vim new file mode 100644 index 0000000..2184f78 --- /dev/null +++ b/vimrcs/my-configs.vim @@ -0,0 +1,35 @@ +" Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab + set stal=2 +catch +endtry + +set relativenumber +set cursorline +set number +set noeol + +" if has("mac") +" set nocursorline +" +" if exists("+relativenumber") +" set norelativenumber +" endif +" +" set foldlevel=0 +" set foldmethod=manual +" endif + +" let updatetime=300 +" au CursorHold * silent! update +" Autosave only when there is something to save. Always saving makes build +" watchers crazy +function! SaveIfUnsaved() + if &modified + :silent! w + endif +endfunction +au FocusLost,BufLeave,CursorHold * :call SaveIfUnsaved() +" Read the file on focus/buffer enter +au FocusGained,BufEnter * :silent! ! diff --git a/vimrcs/neovim/completion-nvim.vim b/vimrcs/neovim/completion-nvim.vim new file mode 100644 index 0000000..10ab778 --- /dev/null +++ b/vimrcs/neovim/completion-nvim.vim @@ -0,0 +1,20 @@ +autocmd BufEnter * lua require'completion'.on_attach() + +" Use and to navigate through popup menu +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" Set completeopt to have a better completion experience +set completeopt=menuone,noinsert,noselect + +" Avoid showing message extra message when using completion +" set shortmess+=c +let g:completion_chain_complete_list = { + \ 'default': [ + \ {'complete_items': ['tabnine', 'lsp']}, + \ {'mode': ''}, + \ {'mode': ''} + \] +\} + +let g:completion_matching_smart_case = 1 diff --git a/vimrcs/neovim/neovim.vim b/vimrcs/neovim/neovim.vim index 369ffb7..48d666d 100644 --- a/vimrcs/neovim/neovim.vim +++ b/vimrcs/neovim/neovim.vim @@ -1,10 +1,4 @@ -tnoremap - -tnoremap h -tnoremap j -tnoremap k -tnoremap l if has('nvim') nmap h - endif -map tt :terminal + set shada=!,'1000,<50,s10,h +endif diff --git a/vimrcs/neovim/nvim-lsp.vim b/vimrcs/neovim/nvim-lsp.vim new file mode 100644 index 0000000..f8e5422 --- /dev/null +++ b/vimrcs/neovim/nvim-lsp.vim @@ -0,0 +1,15 @@ +lua <gd lua vim.lsp.buf.declaration() +nnoremap gD lua vim.lsp.buf.definition() +nnoremap lua vim.lsp.buf.definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gr lua vim.lsp.buf.references() + diff --git a/vimrcs/onedark.vim b/vimrcs/onedark.vim new file mode 100644 index 0000000..62b320d --- /dev/null +++ b/vimrcs/onedark.vim @@ -0,0 +1,16 @@ +" if (has("nvim")) +" "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > +" let $NVIM_TUI_ENABLE_TRUE_COLOR=1 +" endif +" "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > +" "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > +" " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > +" if (has("termguicolors")) +" set termguicolors +" endif +" +" colorscheme onedark +" +" augroup backgroundColorScheme +" au ColorScheme * hi Normal ctermbg=None +" augroup END diff --git a/vimrcs/opinionated/colorscheme.vim b/vimrcs/opinionated/colorscheme.vim deleted file mode 100644 index e6344b2..0000000 --- a/vimrcs/opinionated/colorscheme.vim +++ /dev/null @@ -1,10 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" use tommorow Colorscheme -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -if has("gui_running") - colorscheme Tomorrow -else - set background=light - colorscheme Tomorrow -endif diff --git a/vimrcs/opinionated/d-is-for-delete.vim b/vimrcs/opinionated/d-is-for-delete.vim index 5c5547b..a22a659 100644 --- a/vimrcs/opinionated/d-is-for-delete.vim +++ b/vimrcs/opinionated/d-is-for-delete.vim @@ -1,4 +1,4 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => pazams opinionated- ‘d is for delete’ & ‘ leader-d is for cut’ (shared clipboard register mode) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/vimrcs/opinionated/escape-key.vim b/vimrcs/opinionated/escape-key.vim index a5b4f93..623918a 100644 --- a/vimrcs/opinionated/escape-key.vim +++ b/vimrcs/opinionated/escape-key.vim @@ -2,7 +2,7 @@ " map escape key """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -imap kj +" imap kj if has('nvim') tnoremap kj diff --git a/vimrcs/opinionated/experiment.vim b/vimrcs/opinionated/experiment.vim index 4e94514..f56091f 100644 --- a/vimrcs/opinionated/experiment.vim +++ b/vimrcs/opinionated/experiment.vim @@ -2,10 +2,58 @@ " => Fast editing and reloading of experiment configs (do not edit) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" map e :e! ~/.vim_runtime3/vimrcs/opinionated/experiment.vim -autocmd! bufwritepost vimrc source ~/.vim_runtime3/opinionated/vimrcs/experiment.vim - +autocmd! bufwritepost ~/.vim_runtime3/vimrcs/opinionated/experiment.vim source ~/.vimrc """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Edit below here experimental configs """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Performance improvments +" noremap a :call CmdLineNew() +" +" function! CmdLineNew() +" " exe "menu Foo.zigi :" . "hello world" +" exe "hello world" . "normal! " +" emenu Foo.zigi +" unmenu Foo +" endfunction + + +function! Redir(cmd) + for win in range(1, winnr('$')) + if getwinvar(win, 'scratch') + execute win . 'windo close' + endif + endfor + if a:cmd =~ '^!' + execute "let output = system('" . substitute(a:cmd, '^!', '', '') . "')" + else + redir => output + execute a:cmd + redir END + endif + vnew + let w:scratch = 1 + setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile + call setline(1, split(output, "\n")) +endfunction + +command! -nargs=1 -complete=command Redir silent call Redir() + +" Usage: +" :Redir hi ............. show the full output of command ':hi' in a scratch window +" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window + +" ZIGI TODO: remove this if you see it in the future +" command! TestRemoveLine call TestRemoveLine() +" function! TestRemoveLine() +" let wordUnderCursor = expand("") +" let original_line = line(".") +" call cursor(0, 0) +" let res = search(wordUnderCursor, 'nw') +" if original_line == res +" normal! dd +" endif +" " echo(res) +" " echo(myline) +" endfunction diff --git a/vimrcs/opinionated/macro.vim b/vimrcs/opinionated/macro.vim new file mode 100644 index 0000000..a03f64a --- /dev/null +++ b/vimrcs/opinionated/macro.vim @@ -0,0 +1,2 @@ +nnoremap Q @q + diff --git a/vimrcs/opinionated/terminal.vim b/vimrcs/opinionated/terminal.vim new file mode 100644 index 0000000..2a4046c --- /dev/null +++ b/vimrcs/opinionated/terminal.vim @@ -0,0 +1,7 @@ +tnoremap +tnoremap h +tnoremap j +tnoremap k +tnoremap l +map tt :terminal + diff --git a/vimrcs/plugins-config/ack.vim b/vimrcs/plugins-config/ack.vim new file mode 100644 index 0000000..cad7859 --- /dev/null +++ b/vimrcs/plugins-config/ack.vim @@ -0,0 +1,9 @@ +"""""""""""""""""""""""""""""" +" => ack with silver searcher (ag) +"""""""""""""""""""""""""""""" +if executable('rg') + let g:ackprg = 'rg -S --vimgrep' +elseif executable('ag') + let g:ackprg = 'ag --vimgrep' +endif + diff --git a/vimrcs/plugins-config/ale.vim b/vimrcs/plugins-config/ale.vim new file mode 100644 index 0000000..c537869 --- /dev/null +++ b/vimrcs/plugins-config/ale.vim @@ -0,0 +1,14 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Ale linters +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:ale_fixers = { +\ 'javascript': ['eslint'], +\ 'python': ['autopep8', 'yapf'] +\} +let g:ale_linters = { +\ 'javascript': ['eslint'], +\ 'python': ['autopep8', 'flake8', 'isort', 'yapf'] +\} +let g:ale_fix_on_save=1 +let g:ale_javascript_prettier_options = '--single-quote' + diff --git a/vimrcs/plugins-config/autosave.vim b/vimrcs/plugins-config/autosave.vim new file mode 100644 index 0000000..c867262 --- /dev/null +++ b/vimrcs/plugins-config/autosave.vim @@ -0,0 +1,21 @@ +" let g:auto_save = 1 " enable AutoSave on Vim startup +" let g:auto_save_silent = 0 " do not display the auto-save notification +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Auto save +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" augroup autosavefiles +" autocmd! +" autocmd TextChanged,TextChangedI,InsertLeave * silent write +" augroup END + +augroup autosavefiles + autocmd! + autocmd CursorHold * silent update +augroup END +" augroup autosavefiles +" autocmd! CursorHold +" autocmd CursorHold silent update +" augroup END +" +" test 2 test 3 test +" set autowrite diff --git a/vimrcs/plugins-config/coc.nvim.vim b/vimrcs/plugins-config/coc.nvim.vim new file mode 100644 index 0000000..14a8bd9 --- /dev/null +++ b/vimrcs/plugins-config/coc.nvim.vim @@ -0,0 +1,165 @@ +" Set internal encoding of vim, not needed on neovim, since coc.nvim using some +" unicode characters in the file autoload/float.vim +set encoding=utf-8 + +" TextEdit might fail if hidden is not set. +set hidden + +" Some servers have issues with backup files, see #649. +set nobackup +set nowritebackup + +" Give more space for displaying messages. +set cmdheight=2 + +" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +" delays and poor user experience. +set updatetime=300 + +" Don't pass messages to |ins-completion-menu|. +set shortmess+=c + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Make auto-select the first completion item and notify coc.nvim to +" format on enter, could be remapped by other vim plugin +inoremap pumvisible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) + +" Formatting selected code. +xmap Ï (coc-format-selected) +nmap Ï (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder. + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying codeAction to the selected region. +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap keys for applying codeAction to the current buffer. +nmap ac (coc-codeaction) +" Apply AutoFix to problem on the current line. +nmap qf (coc-fix-current) + +" Map function and class text objects +" NOTE: Requires 'textDocument.documentSymbol' support from the language server. +xmap if (coc-funcobj-i) +omap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap af (coc-funcobj-a) +xmap ic (coc-classobj-i) +omap ic (coc-classobj-i) +xmap ac (coc-classobj-a) +omap ac (coc-classobj-a) + +" Remap and for scroll float windows/popups. +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Use CTRL-S for selections ranges. +" Requires 'textDocument/selectionRange' support of language server. +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocAction('format') + +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer. +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support. +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline. +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} +let g:coc_disable_transparent_cursor = 1 +" Mappings for CoCList +" Show all diagnostics. +nnoremap a :CocList diagnostics +" Manage extensions. +nnoremap e :CocList extensions +" Show commands. +nnoremap c :CocList commands +" Find symbol of current document. +nnoremap o :CocList outline +" Search workspace symbols. +nnoremap s :CocList -I symbols +" Do default action for next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list. +nnoremap p :CocListResume diff --git a/vimrcs/plugins-config/easyescape.vim b/vimrcs/plugins-config/easyescape.vim new file mode 100644 index 0000000..bf37087 --- /dev/null +++ b/vimrcs/plugins-config/easyescape.vim @@ -0,0 +1 @@ +let g:easyescape_timeout = 300 diff --git a/vimrcs/plugins-config/fugitive.vim b/vimrcs/plugins-config/fugitive.vim new file mode 100644 index 0000000..8bdef98 --- /dev/null +++ b/vimrcs/plugins-config/fugitive.vim @@ -0,0 +1,9 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Git Fugitive +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +augroup hidefugitivebuffers + autocmd! + autocmd BufReadPost fugitive://* set bufhidden=delete +augroup END +nmap gp :Gpush +nmap gs :Gstatus diff --git a/vimrcs/plugins-config/fzf.vim b/vimrcs/plugins-config/fzf.vim new file mode 100644 index 0000000..2171e97 --- /dev/null +++ b/vimrcs/plugins-config/fzf.vim @@ -0,0 +1,35 @@ +"""""""""""""""""""""""""""""" +" => FZF +"""""""""""""""""""""""""""""" +map o :Buffers +map s :Rg +map m :Files ~/workspace/ +map f :Files +" uncomment after testing out telescope +" map ff :Files ~/workspace +nnoremap mm :cd ~/workspace:Rg +nnoremap h :History +nnoremap hh :History: + + +nmap / RgRawSearch +vmap / RgRawVisualSelection +nmap * RgRawWordUnderCursor +nmap u RgRawWordUnderCursor + +" Augmenting Ag command using fzf#vim#with_preview function +" * fzf#vim#with_preview([[options], [preview window], [toggle keys...]]) +" * For syntax-highlighting, Ruby and any of the following tools are required: +" - Bat: https://github.com/sharkdp/bat +" - Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php +" - CodeRay: http://coderay.rubychan.de/ +" - Rouge: https://github.com/jneen/rouge +" +" :Ag - Start fzf with hidden preview window that can be enabled with "?" key +" :Ag! - Start fzf in fullscreen and display the preview window above +command! -bang -nargs=* Ag + \ call fzf#vim#ag(, + \ 0 ? fzf#vim#with_preview('up:60%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ 0) +command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(), 1, 0) diff --git a/vimrcs/plugins-config/gtfo.vim b/vimrcs/plugins-config/gtfo.vim new file mode 100644 index 0000000..e0c2c56 --- /dev/null +++ b/vimrcs/plugins-config/gtfo.vim @@ -0,0 +1,2 @@ +let g:gtfo#terminals = { 'mac': 'iterm' } + diff --git a/vimrcs/plugins-config/markdown-preview.vim b/vimrcs/plugins-config/markdown-preview.vim new file mode 100644 index 0000000..9ac4a42 --- /dev/null +++ b/vimrcs/plugins-config/markdown-preview.vim @@ -0,0 +1,79 @@ +" set to 1, nvim will open the preview window after entering the markdown buffer +" default: 0 +let g:mkdp_auto_start = 0 + +" set to 1, the nvim will auto close current preview window when change +" from markdown buffer to another buffer +" default: 1 +let g:mkdp_auto_close = 1 + +" set to 1, the vim will refresh markdown when save the buffer or +" leave from insert mode, default 0 is auto refresh markdown as you edit or +" move the cursor +" default: 0 +let g:mkdp_refresh_slow = 1 + +" set to 1, the MarkdownPreview command can be use for all files, +" by default it can be use in markdown file +" default: 0 +let g:mkdp_command_for_global = 0 + +" set to 1, preview server available to others in your network +" by default, the server listens on localhost (127.0.0.1) +" default: 0 +let g:mkdp_open_to_the_world = 0 + +" use custom IP to open preview page +" useful when you work in remote vim and preview on local browser +" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 +" default empty +let g:mkdp_open_ip = '' + +" specify browser to open preview page +" default: '' +let g:mkdp_browser = '' + +" set to 1, echo preview page url in command line when open preview page +" default is 0 +let g:mkdp_echo_preview_url = 0 + +" a custom vim function name to open preview page +" this function will receive url as param +" default is empty +let g:mkdp_browserfunc = '' + +" options for markdown render +" mkit: markdown-it options for render +" katex: katex options for math +" uml: markdown-it-plantuml options +" maid: mermaid options +" disable_sync_scroll: if disable sync scroll, default 0 +" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' +" middle: mean the cursor position alway show at the middle of the preview page +" top: mean the vim top viewport alway show at the top of the preview page +" relative: mean the cursor position alway show at the relative positon of the preview page +" hide_yaml_meta: if hide yaml metadata, default is 1 +" sequence_diagrams: js-sequence-diagrams options +let g:mkdp_preview_options = { + \ 'mkit': {}, + \ 'katex': {}, + \ 'uml': {}, + \ 'maid': {}, + \ 'disable_sync_scroll': 0, + \ 'sync_scroll_type': 'middle', + \ 'hide_yaml_meta': 1, + \ 'sequence_diagrams': {} + \ } + +" use a custom markdown style must be absolute path +let g:mkdp_markdown_css = '' + +" use a custom highlight style must absolute path +let g:mkdp_highlight_css = '' + +" use a custom port to start server or random for empty +let g:mkdp_port = '' + +" preview page title +" ${name} will be replace with the file name +let g:mkdp_page_title = '「${name}」' diff --git a/vimrcs/plugins-config/nerdtree.vim b/vimrcs/plugins-config/nerdtree.vim new file mode 100644 index 0000000..3883080 --- /dev/null +++ b/vimrcs/plugins-config/nerdtree.vim @@ -0,0 +1,18 @@ +let g:NERDTreeWinPos = "left" +" let g:NERDTreeWinPos = "right" +let NERDTreeShowHidden=0 +let NERDTreeIgnore = ['\.pyc$', '__pycache__'] +let g:NERDTreeWinSize=35 +let NERDTreeQuitOnOpen=1 +let NERDTreeMinimalUI=1 +map nn :NERDTreeToggle +let g:NERDTreeMapJumpNextSibling = '' +let g:NERDTreeMapJumpPrevSibling = '' +" equivalent to in macs +nmap Ò :NERDTreeFind +nmap :NERDTreeFind +let g:NERDTreeGitStatusUseNerdFonts = 1 +let g:webdevicons_conceal_nerdtree_brackets = 1 +let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1 +" related to fern +let g:fern#renderer = "nerdfont" diff --git a/vimrcs/plugins-config/nvim-lspfuzzy.vim b/vimrcs/plugins-config/nvim-lspfuzzy.vim new file mode 100644 index 0000000..e69de29 diff --git a/vimrcs/plugins-config/plugins-config.vim b/vimrcs/plugins-config/plugins-config.vim index e12a64b..dd980c9 100644 --- a/vimrcs/plugins-config/plugins-config.vim +++ b/vimrcs/plugins-config/plugins-config.vim @@ -1,32 +1,3 @@ -"""""""""""""""""""""""""""""" -" => CTRL-P -"""""""""""""""""""""""""""""" -let g:ctrlp_working_path_mode = 'ra' -let g:ctrlp_map = '' -map j :CtrlP -map :CtrlPBuffer -map m :CtrlPMixed -let g:ctrlp_max_height = 20 -let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' -let g:ctrlp_max_files=0 -let g:ctrlp_max_depth=40 - -"""""""""""""""""""""""""""""" -" => MRU via CTRL-P plugin -"""""""""""""""""""""""""""""" -map f :CtrlPMRU - - -"""""""""""""""""""""""""""""" -" => buffer explorer via CTRL-P plugin -"""""""""""""""""""""""""""""" -map o :CtrlPBuffer - -"""""""""""""""""""""""""""""" -" => tags explorer via CTRL-P plugin -"""""""""""""""""""""""""""""" -nnoremap h :CtrlPTag - """""""""""""""""""""""""""""" " => tagbar (ctags) """""""""""""""""""""""""""""" @@ -38,37 +9,14 @@ nmap :TagbarToggle let Grep_Skip_Dirs = 'RCS CVS SCCS .svn generated' set grepprg=/bin/grep\ -nH -"""""""""""""""""""""""""""""" -" => ack with silver searcher (ag) -"""""""""""""""""""""""""""""" -if executable('ag') - let g:ackprg = 'ag --vimgrep' -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Nerd Tree -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:NERDTreeWinPos = "right" -let NERDTreeShowHidden=0 -let NERDTreeIgnore = ['\.pyc$', '__pycache__'] -let g:NERDTreeWinSize=35 -map nn :NERDTreeTabsToggle -map nf :NERDTreeTabsFind - -" equivalent to in macs -nmap Ò :NERDTreeFind -nmap :NERDTreeFind - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => vim-multiple-cursors -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:multi_cursor_next_key="\" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => vim-airline config (force color) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable the list of buffers let g:airline#extensions#tabline#enabled = 1 +let g:airline_section_c = '%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' +" let g:airline_section_c = '%t' let g:airline_powerline_fonts=1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -77,76 +25,218 @@ let g:airline_powerline_fonts=1 let g:goyo_width=240 let g:goyo_margin_top = 2 let g:goyo_margin_bottom = 2 -nnoremap z :Goyo +nnoremap z :Goyo -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Syntastic (syntax checker) -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:syntastic_python_checkers=['pyflakes'] -let g:syntastic_javascript_checkers = ['jshint'] -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 0 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -let g:syntastic_html_tidy_ignore_errors=[ - \'proprietary attribute "ng-', - \'proprietary attribute "bs-', - \'proprietary attribute "nv-' -\] -" Custom CoffeeScript SyntasticCheck -func! SyntasticCheckCoffeescript() - let l:filename = substitute(expand("%:p"), '\(\w\+\)\.coffee', '.coffee.\1.js', '') - execute "e " . l:filename - execute "SyntasticCheck" - execute "Errors" -endfunc -nnoremap l :call SyntasticCheckCoffeescript() +let g:SuperTabDefaultCompletionType = '' +" better key bindings for UltiSnipsExpandTrigger +let g:UltiSnipsExpandTrigger = "" +let g:UltiSnipsJumpForwardTrigger = "" +let g:UltiSnipsJumpBackwardTrigger = "" +let g:instant_markdown_autostart = 0 +" let g:UltiSnipsSnippetDirectories = ['UltiSnips'] +let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips' +let g:snips_author = 'zigius' +let g:UltiSnipsUsePythonVersion = 3 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Git gutter (Git diff) +" => emmet expand snippet with tab """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -nnoremap b :GitGutterToggle +let g:user_emmet_leader_key='' +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => vim-jsx on regular js files +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:jsx_ext_required = 0 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => YouCompleteMe +" => editorconfig key bindings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -set = -set = +let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] -nnoremap yr :YcmRestartServer -nnoremap :YcmCompleter GoToDefinition -nnoremap :YcmCompleter GoToReferences -let g:ycm_goto_buffer_command = 'vertical-split' -" taken from https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411 -" and http://stackoverflow.com/a/18685821 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => resolve YouCompleteMe & UltiSnips Conflicts +" => Vim language server protocol +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Required for operations modifying multiple buffers like rename. +set hidden +" +" let g:LanguageClient_serverCommands = { +" \ 'javascript': ['/Users/daniel.zinger/.nvm/versions/node/v8.11.3/lib/node_modules/javascript-typescript-langserver/lib/language-server-stdio.js'], +" \ 'javascript.jsx': ['/Users/daniel.zinger/.nvm/versions/node/v8.11.3/lib/node_modules/javascript-typescript-langserver/lib/language-server-stdio.js'], +" \ 'python': ['/Users/daniel.zinger/.pyenv/shims/pyls'] +" \ } +" +" " Automatically start language servers. +" let g:LanguageClient_autoStart = 1 +" let g:LanguageClient_devel = 1 " Use rust debug build +" let g:LanguageClient_loggingLevel = 'DEBUG' " Use highest logging level +" +" nnoremap K :call LanguageClient_textDocument_hover() +" nnoremap gd :call LanguageClient_textDocument_definition() +" nnoremap :call LanguageClient_textDocument_rename() +" autocmd FileType javascript nnoremap +" \ lf :call LanguageClient_textDocument_documentSymbol() +" autocmd FileType javascript.jsx nnoremap +" \ lf :call LanguageClient_textDocument_documentSymbol() + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -function! g:UltiSnips_Complete() - call UltiSnips#ExpandSnippet() - if g:ulti_expand_res == 0 - if pumvisible() - return "\" - else - call UltiSnips#JumpForwards() - if g:ulti_jump_forwards_res == 0 - return "\" - endif - endif - endif - return "" +" => coc.nvim recommended config +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" if hidden not set, TextEdit might fail. +set hidden + +" Better display for messages +set cmdheight=2 + +" Smaller updatetime for CursorHold & CursorHoldI +set updatetime=300 + +" don't give |ins-completion-menu| messages. +set shortmess+=c + +" always show signcolumns +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use for trigger completion. +inoremap coc#refresh() + +" Use for confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" + +" Use `[c` and `]c` for navigate diagnostics +nmap [c (coc-diagnostic-prev) +nmap ]c (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gt (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) +nmap gn (coc-rename) + +" Use K for show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if &filetype == 'vim' + execute 'h '.expand('') + else + call CocAction('doHover') + endif endfunction -au BufEnter * exec "inoremap " . g:UltiSnipsExpandTrigger . " =g:UltiSnips_Complete()" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsListSnippets="" -" this mapping Enter key to to chose the current highlight item -" and close the selection list, same as other IDEs. -" CONFLICT with some plugins like tpope/Endwise -inoremap pumvisible() ? "\" : "\u\" + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +" vmap f (coc-format-selected) +" nmap f (coc-format-selected) + +augroup mygroup + " Highlight symbol under cursor on CursorHold + autocmd CursorHold * silent call CocActionAsync('highlight') + + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + autocmd FileType json syntax match Comment +\/\/.\+$+ + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +vmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) + +" Fix autofix problem of current line +" nmap qf (coc-fix-current) + +" Use `:Format` for format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` for fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + + +" Add diagnostic info for https://github.com/itchyny/lightline.vim +" let g:lightline = { +" \ 'colorscheme': 'wombat', +" \ 'active': { +" \ 'left': [ [ 'mode', 'paste' ], +" \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ] +" \ }, +" \ 'component_function': { +" \ 'cocstatus': 'coc#status' +" \ }, +" \ } +let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}' +let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}' + + +" Using CocList +" Show all diagnostics +nnoremap a :CocList diagnostics +" Manage extensions +nnoremap e :CocList extensions +" Show commands +nnoremap c :CocList commands +" Find symbol of current document +nnoremap o :CocList outline +" Search workspace symbols +nnoremap s :CocList -I symbols +" Do default action for next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list +nnoremap p :CocListResume + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Inc search +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +map / (incsearch-forward) +map ? (incsearch-backward) +map g/ (incsearch-stay) +" Farewell, nnoremap :nohlsearch! This feature turns 'hlsearch' off automatically after searching-related motions. +set hlsearch +let g:incsearch#auto_nohlsearch = 1 +map n (incsearch-nohl-n) +map N (incsearch-nohl-N) +map * (incsearch-nohl-*) +map # (incsearch-nohl-#) +map g* (incsearch-nohl-g*) +map g# (incsearch-nohl-g#) +augroup incsearch-keymap + autocmd! + autocmd VimEnter call s:incsearch_keymap() +augroup END +function! s:incsearch_keymap() + " IncSearchNoreMap (incsearch-next) + " IncSearchNoreMap (incsearch-prev) + " IncSearchNoreMap (incsearch-scroll-f) + " IncSearchNoreMap (incsearch-scroll-b) +endfunction diff --git a/vimrcs/plugins-config/rooter.vim b/vimrcs/plugins-config/rooter.vim new file mode 100644 index 0000000..d4d5008 --- /dev/null +++ b/vimrcs/plugins-config/rooter.vim @@ -0,0 +1,5 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Vim rooter +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:rooter_silent_chdir = 1 + diff --git a/vimrcs/plugins-config/snapshot.vim b/vimrcs/plugins-config/snapshot.vim new file mode 100644 index 0000000..e52fc85 --- /dev/null +++ b/vimrcs/plugins-config/snapshot.vim @@ -0,0 +1,49 @@ +" Generated by vim-plug +" Sun Dec 25 10:51:08 2016 +" :source this file in vim to restore the snapshot +" or execute: vim -S snapshot.vim + +silent! let g:plugs['ack.vim'].commit = 'eede042' +silent! let g:plugs['ctrlp-modified.vim'].commit = '13c9be8' +silent! let g:plugs['ctrlp.vim'].commit = '564176f' +silent! let g:plugs['dash.vim'].commit = '9622102' +silent! let g:plugs['emmet-vim'].commit = '5b21726' +silent! let g:plugs['goyo.vim'].commit = '8e8f1d4' +silent! let g:plugs['nerdtree'].commit = '4dada8c' +silent! let g:plugs['nerdtree-git-plugin'].commit = '18d52b5' +silent! let g:plugs['rainbow_parentheses.vim'].commit = 'eb8baa5' +silent! let g:plugs['sideways.vim'].commit = '4cbb358' +silent! let g:plugs['splitjoin.vim'].commit = '2253e0a' +silent! let g:plugs['supertab'].commit = 'cdaa5c2' +silent! let g:plugs['syntastic'].commit = '675f67e' +silent! let g:plugs['tagbar'].commit = '3a4ea12' +silent! let g:plugs['tcomment_vim'].commit = '952de7f' +silent! let g:plugs['typescript-vim'].commit = '7e25a90' +silent! let g:plugs['ultisnips'].commit = 'f974e03' +silent! let g:plugs['vim-abolish'].commit = '05c7d31' +silent! let g:plugs['vim-airline'].commit = 'e83ed24' +silent! let g:plugs['vim-airline-themes'].commit = '2a97d9e' +silent! let g:plugs['vim-ansible-yaml'].commit = '33643fc' +silent! let g:plugs['vim-exchange'].commit = 'b1cae92' +silent! let g:plugs['vim-flake8'].commit = '91818a7' +silent! let g:plugs['vim-fugitive'].commit = 'b754bc2' +silent! let g:plugs['vim-gitgutter'].commit = '7b81a8a' +silent! let g:plugs['vim-go'].commit = 'e46dd4d' +silent! let g:plugs['vim-javascript'].commit = '521f4ed' +silent! let g:plugs['vim-less'].commit = '6e818d5' +silent! let g:plugs['vim-markdown'].commit = 'a0282ee' +silent! let g:plugs['vim-monokai'].commit = 'ece3e6f' +silent! let g:plugs['vim-nerdtree-tabs'].commit = '5a91230' +silent! let g:plugs['vim-node'].commit = '13b3121' +silent! let g:plugs['vim-obsession'].commit = 'ad1ef9a' +silent! let g:plugs['vim-repeat'].commit = '7a6675f' +silent! let g:plugs['vim-rooter'].commit = 'c92dfe2' +silent! let g:plugs['vim-snippets'].commit = '5f18499' +silent! let g:plugs['vim-surround'].commit = 'e49d6c2' +silent! let g:plugs['vim-tomorrow-theme'].commit = '46994f3' +silent! let g:plugs['vim-zenroom2'].commit = '948734e' +silent! let g:plugs['yajs.vim'].commit = '29e607b' + +PlugUpdate! + + diff --git a/vimrcs/plugins-config/sneak.vim b/vimrcs/plugins-config/sneak.vim new file mode 100644 index 0000000..de03bc8 --- /dev/null +++ b/vimrcs/plugins-config/sneak.vim @@ -0,0 +1,9 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Vim Sneak +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:sneak#use_ic_scs = 1 +map f Sneak_f +map F Sneak_F +map t Sneak_t +map T Sneak_T + diff --git a/vimrcs/plugins-config/telescope.vim b/vimrcs/plugins-config/telescope.vim new file mode 100644 index 0000000..0622ec3 --- /dev/null +++ b/vimrcs/plugins-config/telescope.vim @@ -0,0 +1,6 @@ +" Find files using Telescope command-line sugar. +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags +nnoremap a :lua require'telescope.builtin'.lsp_code_actions{} diff --git a/vimrcs/plugins-config/vimwiki.vim b/vimrcs/plugins-config/vimwiki.vim new file mode 100644 index 0000000..8c550f9 --- /dev/null +++ b/vimrcs/plugins-config/vimwiki.vim @@ -0,0 +1,10 @@ +let g:vimwiki_list = [{ + \ 'path': '~/vimwiki', + \ 'template_path': '~/vimwiki/templates/', + \ 'template_default': 'default', + \ 'syntax': 'markdown', + \ 'ext': '.md', + \ 'path_html': '~/vimwiki/site_html/', + \ 'custom_wiki2html': 'vimwiki_markdown', + \ 'template_ext': '.tpl'}] + diff --git a/vimrcs/python.vim b/vimrcs/python.vim new file mode 100644 index 0000000..7c9751a --- /dev/null +++ b/vimrcs/python.vim @@ -0,0 +1,3 @@ +" based on the following link: https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-Neovim +let g:python_host_prog = $HOME.'/.pyenv/versions/neovim2/bin/python' +let g:python3_host_prog = $HOME.'/.pyenv/versions/neovim3new/bin/python' diff --git a/vimrcs/vscode/init.vim b/vimrcs/vscode/init.vim new file mode 100644 index 0000000..c1ac2f8 --- /dev/null +++ b/vimrcs/vscode/init.vim @@ -0,0 +1,2 @@ +map / +