Skip to content

Commit

Permalink
install vim plug automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
akash0x53 committed Jun 7, 2020
1 parent 5da81cf commit b230eef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
5 changes: 1 addition & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ fi


#------------ setup vimrc -------------
mkdir -p $HOME/.vim
if [ ! -d "$HOME/.vim/autoload" ]; then
git clone https://github.com/tpope/vim-pathogen.git $HOME/.vim/
fi
mkdir -p $HOME/.vim/undodir
link_file vimrc


Expand Down
27 changes: 20 additions & 7 deletions vimrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
"----------- Functions -----------
func TrimTrailingWhiteSpaces()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfunc

func InstallVimPlug()
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
endfunc

"---------- Basic ----------
set nocompatible
set noswapfile "disable ugly .swp files
Expand All @@ -11,6 +25,7 @@ set lazyredraw
set showmatch "show matching parenthesis or similar

"----------- Plugins --------------
call InstallVimPlug()
call plug#begin('~/.vim/plugins')
Plug 'gruvbox-community/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Expand Down Expand Up @@ -63,12 +78,10 @@ let mapleader = ","
nnoremap <leader>e :!pylint -E %<CR>
noremap <leader>w :call TrimTrailingWhiteSpaces()<CR>
noremap <leader><space> :nohl<CR>
noremap <leader>t :botright terminal ++close ++rows=10 bash --rcfile ~/.bash_profile<CR>
if has('mac')
noremap <leader>t :botright terminal ++close ++rows=10 bash --rcfile ~/.bash_profile<CR>
else
noremap <leader>t :botright terminal ++close ++rows=10 bash --rcfile ~/.bashrc<CR>
endif
noremap <leader>p :botright terminal ++close ++rows=10 python<CR>
"----------- Functions -----------
func TrimTrailingWhiteSpaces()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfunc

0 comments on commit b230eef

Please sign in to comment.