From fa1be111d1224f9dad7c4c94ff3ab30f64894023 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sat, 16 Feb 2019 11:44:35 -0500 Subject: added new features goyo, sneak --- init.vim | 9 +++-- install/install.sh | 59 +++++++++++++++++++++++++++++++ install/utils/installer.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++ modules/ale.vim | 2 +- modules/deoplete.vim | 6 +++- modules/general.vim | 34 ++++++++++++------ modules/goyo-limelight.vim | 39 ++++++++++++++++++++ modules/language_server.vim | 11 ++++-- modules/nerdtree.vim | 26 +++++++++++++- modules/plugins.vim | 30 ++++++++++------ modules/pythonpath.vim | 2 +- modules/relativenums.vim | 11 ++++++ utils/installer.sh | 86 --------------------------------------------- 13 files changed, 284 insertions(+), 117 deletions(-) create mode 100755 install/install.sh create mode 100644 install/utils/installer.sh create mode 100644 modules/goyo-limelight.vim create mode 100644 modules/relativenums.vim delete mode 100644 utils/installer.sh diff --git a/init.vim b/init.vim index e7d95036..98abc1a7 100644 --- a/init.vim +++ b/init.vim @@ -11,8 +11,11 @@ source $HOME/.config/nvim/modules/gutentags_plus.vim source $HOME/.config/nvim/modules/markdown-preview.vim source $HOME/.config/nvim/modules/language_server.vim source $HOME/.config/nvim/modules/ale.vim -"install ripgrep" +source $HOME/.config/nvim/modules/goyo-limelight.vim +source $HOME/.config/nvim/modules/relativenums.vim + + +"npm i -g bash-language-server +"install ripgrep" for gutentags to ignore .gitignore "install universal ctags" -"pip install 'python-language-server[all]' -" pip install vim-vint " TODO add this to script npm i -g bash-language-server diff --git a/install/install.sh b/install/install.sh new file mode 100755 index 00000000..ebd186b5 --- /dev/null +++ b/install/install.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +if [ "$(uname)" == "Darwin" ]; then + echo 'MacOS Detected' + echo "installing miniconda" + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/.config/nvim/install/miniconda.sh + echo " Grabbing a font to use foe devicons " + brew tap caskroom/fonts + brew cask install font-hack-nerd-font +elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + echo 'Linux Detected' + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/.config/nvim/install/miniconda.sh + mkdir -p ~/.local/share/fonts + cd ~/.local/share/fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf +fi + +#chmod +x ~/.config/nvim/install/miniconda.sh + +sh ~/.config/nvim/install/miniconda.sh -b -f -p $HOME/.miniconda + +echo 'export PATH="$HOME/.miniconda/bin:$PATH"' >> ~/.bash_profile + +. ~/.bash_profile + +conda create --name neovim python=3.7 --yes + +. activate neovim + +pip install neovim + +. deactivate + +conda create --name pyls python=3.7 --yes + +. activate pyls + +pip install 'python-language-server[all]' +pip install vim-vint + +. deactivate + +pip install 'python-language-server[all]' + +if [ ! -f ~/.bash_aliases ]; then + echo ".bash_aliases not found!" + touch ~/.bash_aliases + echo 'source ~/.bash_aliases' >> ~/.bashrc +fi + +echo 'alias mkenv="conda create --clone pyls --name"' >> ~/.bash_aliases + +echo 'let g:python3_host_prog = expand("~/.miniconda/envs/neovim/bin/python3.7")' > ~/.config/nvim/modules/pythonpath.vim + +if [ ! -d ~/.config/nvim/dein ]; then + echo "dein package manager not found" + sh ~/.config/nvim/install/utils/installer.sh ~/.config/nvim/dein +fi + +rm ~/.config/nvim/install/miniconda.sh diff --git a/install/utils/installer.sh b/install/utils/installer.sh new file mode 100644 index 00000000..de8c093e --- /dev/null +++ b/install/utils/installer.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# Standalone installer for Unixs +# Original version is created by shoma2da +# https://github.com/shoma2da/neobundle_installer + +if [ $# -ne 1 ]; then + echo "You must specify the installation directory!" + exit 1 +fi + +# Convert the installation directory to absolute path +case $1 in + /*) PLUGIN_DIR=$1;; + *) PLUGIN_DIR=$PWD/$1;; +esac +INSTALL_DIR="${PLUGIN_DIR}/repos/github.com/Shougo/dein.vim" +echo "Install to \"$INSTALL_DIR\"..." +if [ -e "$INSTALL_DIR" ]; then + echo "\"$INSTALL_DIR\" already exists!" +fi + +echo "" + +# check git command +type git || { + echo 'Please install git or update your path to include the git executable!' + exit 1 +} +echo "" + +# make plugin dir and fetch dein +if ! [ -e "$INSTALL_DIR" ]; then + echo "Begin fetching dein..." + mkdir -p "$PLUGIN_DIR" + git clone https://github.com/Shougo/dein.vim "$INSTALL_DIR" + echo "Done." + echo "" +fi + +# write initial setting for .vimrc +echo "Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:" +{ + echo "" + echo "" + echo "\"dein Scripts-----------------------------" + echo "if &compatible" + echo " set nocompatible \" Be iMproved" + echo "endif" + echo "" + echo "\" Required:" + echo "set runtimepath+=$INSTALL_DIR" + echo "" + echo "\" Required:" + echo "if dein#load_state('$PLUGIN_DIR')" + echo " call dein#begin('$PLUGIN_DIR')" + echo "" + echo " \" Let dein manage dein" + echo " \" Required:" + echo " call dein#add('$INSTALL_DIR')" + echo "" + echo " \" Add or remove your plugins here like this:" + echo " \"call dein#add('Shougo/neosnippet.vim')" + echo " \"call dein#add('Shougo/neosnippet-snippets')" + echo "" + echo " \" Required:" + echo " call dein#end()" + echo " call dein#save_state()" + echo "endif" + echo "" + echo "\" Required:" + echo "filetype plugin indent on" + echo "syntax enable" + echo "" + echo "\" If you want to install not installed plugins on startup." + echo "\"if dein#check_install()" + echo "\" call dein#install()" + echo "\"endif" + echo "" + echo "\"End dein Scripts-------------------------" + echo "" + echo "" +} + +echo "Done." + +echo "Complete setup dein!" diff --git a/modules/ale.vim b/modules/ale.vim index 1dd151e5..d2834cbd 100644 --- a/modules/ale.vim +++ b/modules/ale.vim @@ -3,7 +3,7 @@ let g:ale_linters = { \ 'cpp' : ['gcc'], \ 'c' : ['gcc'], \ 'vim' : ['vint'], - \ 'python': ['pyls', 'pydocstyle', 'pycodestyle', 'vulture'], + \ 'python': ['pydocstyle', 'pycodestyle', 'vulture'], \ 'javascript': ['eslint'] \} diff --git a/modules/deoplete.vim b/modules/deoplete.vim index 0db16ded..663a780b 100644 --- a/modules/deoplete.vim +++ b/modules/deoplete.vim @@ -4,7 +4,11 @@ let g:deoplete#complete_method = "omnifunc" let g:deoplete#auto_complete_delay = 0 " let g:deoplete#ignore_sources = ['buffer'] -" : completion. +"better nav for omnicomplete +inoremap ("\") +inoremap ("\") + +": completion. ""inoremap pumvisible() ? "\" : "\" "use TAB as the mapping inoremap diff --git a/modules/general.vim b/modules/general.vim index 0752298d..786152d2 100644 --- a/modules/general.vim +++ b/modules/general.vim @@ -10,6 +10,7 @@ nmap \ xmap \ syntax enable " Enables syntax highlighing +set hidden " Required for specific actions that require multiple buffers set nowrap " display long lines as just one line set encoding=utf-8 " The encoding displayed set fileencoding=utf-8 " The encoding written to file @@ -58,25 +59,25 @@ nnoremap :10split term://bash autocmd BufWinEnter,WinEnter term://* startinsert autocmd BufLeave term://* stopinsert " Toggle tagbar -nnoremap :TagbarToggle +"nnoremap :TagbarToggle " Toggle Line numbers -nnoremap :set nonumber! +"nnoremap :set nonumber! " Toggle NERDTree -nnoremap :NERDTreeToggle +"nnoremap :NERDTreeToggle " Startify -nnoremap :Startify +"nnoremap :Startify " Get rid of highlights after search -nnoremap :nohlsearch +"nnoremap :nohlsearch " Toggle open buffers -nnoremap :BuffergatorToggle +" nnoremap :BuffergatorToggle " For fuzzy finder ""nnoremap :Files " F10 split vertical -nnoremap :vsplit +"nnoremap :vsplit " F11 split horizontal -nnoremap :split +"nnoremap :split " Make current buffer only buffer -nnoremap :only +"nnoremap :only " Remap window switch " Switch to rename for LSP to do add leader ""nnoremap :SearchTasks * @@ -84,12 +85,22 @@ nnoremap :only nnoremap n :NERDTreeToggle nnoremap m :TagbarToggle nnoremap l :set nonumber! +nnoremap o :only nnoremap s :Startify nnoremap w :w -nnoremap b : nnoremap p :pclose +nnoremap bu :BuffergatorToggle +nnoremap gy :Goyo +nnoremap hi :nohlsearch +nnoremap hs :split +nnoremap vs :vsplit +nnoremap gh :call LanguageClient_textDocument_hover() +nnoremap gd :call LanguageClient_textDocument_definition() +nnoremap gr :call LanguageClient_textDocument_rename() +nnoremap gc :call LanguageClient_contextMenu() +nnoremap fr :call LanguageClient_textDocument_references() -" Split edit your vimrc. Type space, v, r in sequence to trigger +" This is a funtion to open any file with (key sequence) fun! OpenConfigFile(file) if (&filetype ==? 'startify') execute 'e ' . a:file @@ -98,6 +109,7 @@ nnoremap p :pclose endif endfun nnoremap in :call OpenConfigFile('~/.config/nvim/init.vim') +nnoremap bashrc :call OpenConfigFile('~/.bashrc') nnoremap h nnoremap j diff --git a/modules/goyo-limelight.vim b/modules/goyo-limelight.vim new file mode 100644 index 00000000..5b46b129 --- /dev/null +++ b/modules/goyo-limelight.vim @@ -0,0 +1,39 @@ + +"Make window a little bigger" +" +let g:goyo_width=100 +let g:goy_height=95 +" +" +" Disable Deoplete " + +function! s:goyo_enter() + + call deoplete#custom#option('auto_complete', v:false) + set spell spelllang=en_us + set wrap + set tw=100 + set noshowcmd + set scrolloff=999 +"" set background=light +"" colorscheme flattened_light + Limelight + " ... +endfunction + +function! s:goyo_leave() + + call deoplete#custom#option('auto_complete', v:true) + set nospell + set wrap! + set showcmd + set scrolloff=5 +"" set background=dark +"" colorscheme Tender + Limelight! + " ... +endfunction + +autocmd! User GoyoEnter nested call goyo_enter() +autocmd! User GoyoLeave nested call goyo_leave() + diff --git a/modules/language_server.vim b/modules/language_server.vim index e9ac06c3..e96c45a7 100644 --- a/modules/language_server.vim +++ b/modules/language_server.vim @@ -9,8 +9,13 @@ let g:LanguageClient_serverCommands = { \ 'javascript.jsx': ['tcp://127.0.0.1:2089'], \ 'python': ['pyls'], \ 'sh': ['bash-language-server', 'start'], + \ 'c' : ['cquery'], + \ 'cpp' : ['cquery'], \ } -nnoremap K :call LanguageClient#textDocument_hover() -nnoremap gd :call LanguageClient#textDocument_definition() -nnoremap :call LanguageClient#textDocument_rename() +nnoremap gh :call LanguageClient_textDocument_hover() +nnoremap gd :call LanguageClient_textDocument_definition() +nnoremap gr :call LanguageClient_textDocument_rename() +nnoremap gc :call LanguageClient_contextMenu() +nnoremap fr :call LanguageClient_textDocument_references() + diff --git a/modules/nerdtree.vim b/modules/nerdtree.vim index e0ba7ea0..e445a189 100644 --- a/modules/nerdtree.vim +++ b/modules/nerdtree.vim @@ -1 +1,25 @@ -let NERDTreeShowHidden = 1 +let NERDTreeShowHidden = 1 " show hidden files + +" automatically close when you open a file" +"let NERDTreeQuitOnOpen = 1 + +" let nvim close when nerdtree is last thing" +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + + +" nerdtree will delete buffer of file " + + let NERDTreeAutoDeleteBuffer = 1 + +" if you need help press ? while in nerdtree " +""let NERDTreeMinimalUI = 1 +let NERDTreeDirArrows = 1 + + +"This depends on vim-nerdtree-syntax-highlight" +let g:NERDTreeFileExtensionHighlightFullName = 1 +let g:NERDTreeExactMatchHighlightFullName = 1 +let g:NERDTreePatternMatchHighlightFullName = 1 + +let g:NERDTreeHighlightFolders = 1 " enables folder icon highlighting using exact match +let g:NERDTreeHighlightFoldersFullName = 1 " highlights the folder name diff --git a/modules/plugins.vim b/modules/plugins.vim index 714c6f27..feaa9ed2 100644 --- a/modules/plugins.vim +++ b/modules/plugins.vim @@ -9,10 +9,13 @@ if dein#load_state('~/.config/nvim/dein') call dein#begin('~/.config/nvim/dein') - " Themes - call dein#add('liuchengxu/space-vim-dark') - call dein#add('joshdick/onedark.vim') - call dein#add('morhetz/gruvbox') + " All the Themes + call dein#add('flazz/vim-colorschemes') + " call dein#add('liuchengxu/space-vim-dark') + " call dein#add('joshdick/onedark.vim') + " call dein#add('morhetz/gruvbox') + " Neoterm + call dein#add('kassio/neoterm') call dein#add('jacoborus/tender.vim') " Better Syntax Support call dein#add('sheerun/vim-polyglot') @@ -21,6 +24,9 @@ if dein#load_state('~/.config/nvim/dein') call dein#add('vim-airline/vim-airline-themes') " File manager call dein#add('scrooloose/NERDTree') + " Icons + call dein#add('ryanoasis/vim-devicons') + call dein#add('tiagofumo/vim-nerdtree-syntax-highlight') " Start Screen call dein#add('mhinz/vim-startify') " For ctags @@ -43,16 +49,20 @@ if dein#load_state('~/.config/nvim/dein') " Fuzzy finder call dein#add('junegunn/fzf.vim', { 'dir': '~/.fzf', 'do': './install --all' }) call dein#add('junegunn/fzf') - - - "Git + " Sneak mode " + call dein#add('justinmk/vim-sneak') + ""Git call dein#add('airblade/vim-gitgutter') call dein#add('tpope/vim-fugitive') " BufOnly use :BufOnly to unload all or pass it a single buffer call dein#add('vim-scripts/BufOnly.vim') - " Markdown viewer TODO Fix this stupid thing - "call dein#add('iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }) - + " Distraction free writing " + call dein#add('junegunn/goyo.vim') + call dein#add('junegunn/limelight.vim') + "Markdown viewer TODO Fix this stupid thing + call dein#add('iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }) +"" call dein#add('iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }}) +"" call dein#add('euclio/vim-markdown-composer') call dein#add('~/.config/nvim/dein/repos/github.com/Shougo/dein.vim') call dein#add('Shougo/deoplete.nvim', {'do': 'UpdateRemotePlugins'}) call dein#add('Shougo/neoinclude.vim') diff --git a/modules/pythonpath.vim b/modules/pythonpath.vim index b0607962..676078bc 100644 --- a/modules/pythonpath.vim +++ b/modules/pythonpath.vim @@ -1 +1 @@ -let g:python3_host_prog = expand('~/Miniconda/envs/neovim/bin/python3.7') +let g:python3_host_prog = expand("~/.miniconda/envs/neovim/bin/python3.7") diff --git a/modules/relativenums.vim b/modules/relativenums.vim new file mode 100644 index 00000000..6451203f --- /dev/null +++ b/modules/relativenums.vim @@ -0,0 +1,11 @@ +function! NumberToggle() + if(&relativenumber == 1) + set number + set norelativenumber + else + set number + set relativenumber + endif +endfunc + +nnoremap rn :call NumberToggle() diff --git a/utils/installer.sh b/utils/installer.sh deleted file mode 100644 index de8c093e..00000000 --- a/utils/installer.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# Standalone installer for Unixs -# Original version is created by shoma2da -# https://github.com/shoma2da/neobundle_installer - -if [ $# -ne 1 ]; then - echo "You must specify the installation directory!" - exit 1 -fi - -# Convert the installation directory to absolute path -case $1 in - /*) PLUGIN_DIR=$1;; - *) PLUGIN_DIR=$PWD/$1;; -esac -INSTALL_DIR="${PLUGIN_DIR}/repos/github.com/Shougo/dein.vim" -echo "Install to \"$INSTALL_DIR\"..." -if [ -e "$INSTALL_DIR" ]; then - echo "\"$INSTALL_DIR\" already exists!" -fi - -echo "" - -# check git command -type git || { - echo 'Please install git or update your path to include the git executable!' - exit 1 -} -echo "" - -# make plugin dir and fetch dein -if ! [ -e "$INSTALL_DIR" ]; then - echo "Begin fetching dein..." - mkdir -p "$PLUGIN_DIR" - git clone https://github.com/Shougo/dein.vim "$INSTALL_DIR" - echo "Done." - echo "" -fi - -# write initial setting for .vimrc -echo "Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:" -{ - echo "" - echo "" - echo "\"dein Scripts-----------------------------" - echo "if &compatible" - echo " set nocompatible \" Be iMproved" - echo "endif" - echo "" - echo "\" Required:" - echo "set runtimepath+=$INSTALL_DIR" - echo "" - echo "\" Required:" - echo "if dein#load_state('$PLUGIN_DIR')" - echo " call dein#begin('$PLUGIN_DIR')" - echo "" - echo " \" Let dein manage dein" - echo " \" Required:" - echo " call dein#add('$INSTALL_DIR')" - echo "" - echo " \" Add or remove your plugins here like this:" - echo " \"call dein#add('Shougo/neosnippet.vim')" - echo " \"call dein#add('Shougo/neosnippet-snippets')" - echo "" - echo " \" Required:" - echo " call dein#end()" - echo " call dein#save_state()" - echo "endif" - echo "" - echo "\" Required:" - echo "filetype plugin indent on" - echo "syntax enable" - echo "" - echo "\" If you want to install not installed plugins on startup." - echo "\"if dein#check_install()" - echo "\" call dein#install()" - echo "\"endif" - echo "" - echo "\"End dein Scripts-------------------------" - echo "" - echo "" -} - -echo "Done." - -echo "Complete setup dein!" -- cgit v1.2.3