Advertisement
voyeg3r

switchvim.sh

Dec 2nd, 2019
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. #     Filename: swichvim.sh
  3. #      Created: 2019-11-16 09:54
  4. #  Last Change: nov 18 2019 12:39
  5. #          vim: ft=sh:fdm=syntax:nu:
  6. # This aims to: swich nvim settings
  7. #        Autor: Sergio Araujo
  8. #         site: https://dev.to/voyeg3r
  9. #       github: @voyeg3r
  10. #       e-mail: <voyeg3r ✉ gmail.com>
  11. #      Licence: GPL (see http://www.gnu.orswimg/licenses/gpl.txt)
  12.  
  13.  
  14. currentvim=$(ls -l ~/.config/nvim | awk '{print $NF}')
  15.  
  16. swich(){
  17.     if [ "$currentvim" == "$HOME/.dotfiles/nvim2" ]; then
  18.         ln -sfvn $HOME/.dotfiles/nvim $HOME/.config/nvim
  19.     else
  20.         ln -sfvn $HOME/.dotfiles/nvim2 $HOME/.config/nvim
  21.     fi
  22. }
  23.  
  24. echo "--------------------------------------------------"
  25. echo "Current vim is: $currentvim"
  26. echo "--------------------------------------------------"
  27. echo
  28. read -r -p "Do you want to swich? [Y/n]: " response
  29. response=${response,,} # tolower
  30.  
  31. if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
  32.     swich
  33. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement