Advertisement
Red_Fisher

setup_vim.sh

Sep 13th, 2021 (edited)
1,182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.28 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. ##
  4. ## Install vim - FreeBSD, apt-based, rpm-based
  5. ##
  6. PKG_MANAGERS=( `which pkg` `which apt-get` `which yum` )
  7.  
  8. declare -A PKG_INSTALL_CMDS
  9. PKG_INSTALL_CMDS=( [pkg]="add" [apt-get]="install" [yum]="install" )
  10.  
  11. for mgr in $PKG_MANAGERS; do
  12.         if [ -n "$mgr" ]; then
  13.                 PKG_MGR_CMD="$mgr"
  14.         fi
  15. done
  16.  
  17. if [ -z "$PKG_MGR_CMD" ]; then
  18.         echo "No apt/pkg/yum found. Please update PKG_MANAGERS array with valid package manager."
  19.         exit 1
  20. fi
  21.  
  22. sudo $PKG_MGR_CMD ${PKG_INSTALL_CMDS["$(echo $PKG_MGR_CMD | awk -F '/' '{ print $NF }')"]} vim git python3 python3-pip
  23. pip3 install --user pynvim
  24. ##
  25. ##
  26. ##
  27.  
  28. ## Vars for vim-jenkins
  29. read -p "(vim-jenkins) JENKINS_URL > " JENKINS_URL
  30. read -p "(vim-jenkins) JENKINS_USERNAME > " JENKINS_USERNAME
  31. read -s -p "(vim-jenkins) JENKINS_TOKEN > " JENKINS_TOKEN
  32.  
  33. ##
  34. ## Install vim-plug ; write config ; install modules
  35. ## https://github.com/junegunn/vim-plug
  36. mkdir -pv ~/.vim/{autoload,plugged}
  37.  
  38. curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
  39.    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  40.  
  41. echo "\
  42. \" Specify a directory for plugins
  43. \" - For Neovim: stdpath('data') . '/plugged'
  44. \" - Avoid using standard Vim directory names like 'plugin'
  45. call plug#begin('~/.vim/plugged')
  46.  
  47. Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
  48.  
  49. Plug 'tpope/vim-fugitive'
  50.  
  51. Plug 'itchyny/lightline.vim'
  52.  
  53. Plug 'itchyny/vim-gitbranch'
  54.  
  55. Plug 'macthecadillac/lightline-gitdiff'
  56.  
  57. Plug 'preservim/nerdtree'
  58.  
  59. Plug 'vim-ctrlspace/vim-ctrlspace'
  60.  
  61. \" linter
  62. Plug 'dense-analysis/ale'
  63.  
  64. \" completion
  65. if has('nvim')
  66.  Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  67. else
  68.  Plug 'Shougo/deoplete.nvim'
  69.  Plug 'roxma/nvim-yarp'
  70.  Plug 'roxma/vim-hug-neovim-rpc'
  71. endif
  72.  
  73. Plug 'skywind3000/asyncrun.vim'
  74.  
  75. Plug 'pseewald/vim-anyfold'
  76.  
  77. Plug 'dbeniamine/cheat.sh-vim'
  78.  
  79. Plug 'martinda/Jenkinsfile-vim-syntax'
  80.  
  81. Plug 'burnettk/vim-jenkins'
  82.  
  83. \" Initialize plugin system
  84. call plug#end()
  85.  
  86. let g:lightline = {
  87.      \ 'colorscheme': 'wombat',
  88.      \ 'active': {
  89.      \   'left': [ [ 'mode', 'paste' ],
  90.      \             [ 'gitbranch', 'gitstatus', 'readonly', 'filename', 'modified' ] ]
  91.      \ },
  92.      \ 'component_function': {
  93.      \   'gitbranch': 'fugitive#head'
  94.       \ },
  95.       \   'component_visible_condition': {
  96.       \     'gitstatus': 'lightline_gitdiff#get_status() !=# \"\"',
  97.       \   },
  98.       \ }
  99.  
  100. set nocompatible
  101. set hidden
  102. set encoding=utf-8
  103.  
  104. \"set number
  105. set expandtab
  106. set tabstop=4
  107.  
  108. \"nerdtree hide
  109. nmap <F2> :NERDTreeToggle<CR>
  110. set mouse=a
  111.  
  112. \"line nums
  113. set number
  114.  
  115. \" ale fixers
  116. let g:ale_fixers = {
  117. \   '*': ['remove_trailing_lines', 'trim_whitespace']
  118. \}
  119. \" Set this variable to 1 to fix files when you save them.
  120. let g:ale_fix_on_save = 1
  121.  
  122. \" leader
  123. let mapleader=" "
  124.  
  125. \" anyfold
  126. filetype plugin indent on \" required
  127. syntax on                 \" required
  128. autocmd Filetype Jenkinsfile,ansible,yaml,bash,sh,python,groovy,json,ruby,yaml.ansible AnyFoldActivate
  129. set foldlevel=0
  130.  
  131. \" vim-jenkins to interact with jenkins (pipelines)
  132. let g:jenkins_url = '$JENKINS_URL'
  133. let g:jenkins_username = '$JENKINS_USERNAME'
  134. let g:jenkins_password = '$JENKINS_TOKEN'
  135. " > ~/.vimrc
  136.  
  137. vim ~/.vimrc -c PlugInstall
  138. ##
  139. ##
  140. ##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement