Improved script -- clipboard for vim on

This commit is contained in:
2025-09-02 10:39:30 +03:00
parent a2c4e55a44
commit df48fe3acb
3 changed files with 30 additions and 60 deletions

5
.vimrc
View File

@@ -63,6 +63,7 @@ set number
" This disables the creation of backup files. " This disables the creation of backup files.
set nobackup set nobackup
" To allow moving to different buffer without saving the current buffer.
set hidden set hidden
@@ -256,6 +257,8 @@ let NERDTreeShowHidden = 1
" For majutsushi/tagbar: the ultimate tag bar " For majutsushi/tagbar: the ultimate tag bar
nmap <F8> :TagbarToggle<CR> nmap <F8> :TagbarToggle<CR>
" For morhetz/gruvbox " For morhetz/gruvbox
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. "Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support "If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
@@ -295,7 +298,7 @@ let g:gutentags_cache_dir = expand('~/.cache/tags')
" change focus to quickfix window after search (optional). " change focus to quickfix window after search (optional).
"let g:gutentags_plus_switch = 1 "let g:gutentags_plus_switch = 1
let g:gutentags_trace = 1 "let g:gutentags_trace = 1
let g:gutentags_define_advanced_commands = 1 let g:gutentags_define_advanced_commands = 1

View File

@@ -1,8 +0,0 @@
#!/bin/bash
echo "All arguments: $@"
opts=$(getopt -o a --long help,dir::,mode: -- "$@")
eval set -- "$opts"
echo "All arguments after getopt: $@"

View File

@@ -9,7 +9,6 @@ cmt
user="" user=""
if [ "$(whoami)" = "root" ]; then if [ "$(whoami)" = "root" ]; then
user="" user=""
else else
@@ -27,35 +26,26 @@ function settingUpVimrc {
# Setting up the .vimrc # Setting up the .vimrc
VIMRC_LOCATION=$($user find $HOME/ .vimrc)
VIMRC_LOCATION=$(find $HOME/ .vimrc)
if [ "$HOME/.vimrc" = "$VIMRC_LOCATION" ]; then if [ "$HOME/.vimrc" = "$VIMRC_LOCATION" ]; then
$user mv $HOME/.vimrc $HOME/.vimrc.bck
mv $HOME/.vimrc $HOME/.vimrc.bck
fi fi
cp $(pwd)/.vimrc $HOME/.vimrc cp $(pwd)/.vimrc $HOME/.vimrc
} }
# To remove vimrc. # To remove vimrc.
function removeVimrc { function removeVimrc {
$user apt purge universal-ctags -y $user apt purge universal-ctags -y
$user apt install -y global $user apt install -y global
VIMRC_LOCATION=$(find $HOME/ -type f -name .vimrc.bck) VIMRC_LOCATION=$($user find $HOME/ -type f -name .vimrc.bck)
if [ "$HOME/.vimrc.bck" = "$VIMRC_LOCATION" ]; then if [ "$HOME/.vimrc.bck" = "$VIMRC_LOCATION" ]; then
$user rm $HOME/.vimrc
rm $HOME/.vimrc $user mv $HOME/.vimrc.bck $HOME/.vimrc
mv $HOME/.vimrc.bck $HOME/.vimrc
fi fi
} }
@@ -64,21 +54,12 @@ function removeVimrc {
function settingUpLatestVim { function settingUpLatestVim {
# Installing the required packages. # Installing the required packages.
$user apt install -y libncurses-dev libatk1.0-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev \
$user apt install -y libncurses5-dev libgtk2.0-dev libatk1.0-dev \ libpython3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
libcairo2-dev libx11-dev libxpm-dev libxt-dev python3-dev \
python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
$user apt install -y libncurses-dev
# Clone the vim official repo.
git clone https://github.com/vim/vim.git ~/
# Configure for compilation. # Configure for compilation.
local DIR='/usr/local' # Directory to setup the latest vim build. local DIR='/usr/local' # Directory to setup the latest vim build.
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
DIR=$1 DIR=$1
fi fi
@@ -87,12 +68,12 @@ python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
$user apt remove -y vim vim-runtime gvim $user apt remove -y vim vim-runtime gvim
$user apt remove -y vim-tiny vim-comman vim-gui-comman vim-nox $user apt remove -y vim-tiny vim-comman vim-gui-comman vim-nox
else else
$user mkdir ~/Vim mkdir $DIR
$user mkdir ~/Vim/share/vim/vim91 mkdir -p $DIR/share/vim/vim91
sudo echo -e "\n\n\nalias vim=~/Vim" >> ~/.bashrc echo -e "\n\n\nalias vim=~/Vim" >> ~/.bashrc
source ~/.bashrc
fi fi
cd ~ cd ~
git clone https://github.com/vim/vim.git git clone https://github.com/vim/vim.git
cd ~/vim cd ~/vim
@@ -103,21 +84,26 @@ python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
--with-python3-config-dir=$(python3-config --configdir) \ --with-python3-config-dir=$(python3-config --configdir) \
--enable-perlinterp=yes \ --enable-perlinterp=yes \
--enable-luainterp=yes \ --enable-luainterp=yes \
--enable-gui=gtk3 \ --enable-gui=no \
--enable-cscope \ --enable-cscope \
--prefix=$DIR --prefix=$DIR
# Issue in wayland header file. Hence, running this.
cd ~/vim/src/auto/wayland/
make
cd ~/vim/src cd ~/vim/src
make #VIMRUNTIMEDIR=$DIR/share/vim/vim91 make VIMRUNTIMEDIR=$DIR/share/vim/vim91
# To track the source build as a package for easy uninstallation. # To track the source build as a package for easy uninstallation.
$user apt install checkinstall $user apt install checkinstall
cd ~/vim/src cd ~/vim/src
echo "Current directory: $(pwd)" if [ '/usr/local' = $DIR ]; then
$user checkinstall --fstrans=no # To avoid temporary filesystem translation issue. $user checkinstall --fstrans=no # To avoid temporary filesystem translation issue.
else
make install
fi
# Install plugin for vim-plug. # Install plugin for vim-plug.
vim +PlugInstall +qall vim +PlugInstall +qall
@@ -130,13 +116,11 @@ function removeVim {
# Uninstall Vim # Uninstall Vim
$user apt purge -y vim $user apt purge -y vim
$user apt purge -y libncurses5-dev libgtk2.0-dev libatk1.0-dev \ $user apt purge -y libncurses-dev libatk1.0-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev \ libcairo2-dev libx11-dev libxpm-dev libxt-dev \
python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git libpython3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
local DIR='/usr/local' # Directory to setup the latest vim build. local DIR='/usr/local' # Directory to setup the latest vim build.
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
DIR=$1 DIR=$1
fi fi
@@ -155,7 +139,6 @@ python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
# To setup YouCompleteMe (YCM) # To setup YouCompleteMe (YCM)
function settingUpYCM { function settingUpYCM {
cd ~/ cd ~/
# Installing Vundle and installing the plugin. Also, for vim-plug manager. # Installing Vundle and installing the plugin. Also, for vim-plug manager.
@@ -184,11 +167,8 @@ function removeYCM {
################ Starting the execution here ################### ################ Starting the execution here ###################
# If directory is mentioned. # If directory is mentioned.
echo "All arguments: $@"
opts=$(getopt -o a --long help,dir::,mode: -- "$@") opts=$(getopt -o a --long help,dir::,mode: -- "$@")
eval set -- "$opts" eval set -- "$opts"
echo "All arguments after getopt: $@"
echo "Argument count: $#"
VIM_DIR="" VIM_DIR=""
MODE="" MODE=""
@@ -204,7 +184,7 @@ do
;; ;;
--help) echo -e "$0 --dir=<directory for vim installation> --mode install|uninstall\n" \ --help) echo -e "$0 --dir=<directory for vim installation> --mode install|uninstall\n" \
"--dir : Optional\n" \ "--dir : Optional [E.g: --dir=$HOME/Vim ]\n" \
"--mode : install ( setting up the environment )\n" \ "--mode : install ( setting up the environment )\n" \
" uninstall ( returning to default )\n" " uninstall ( returning to default )\n"
shift shift
@@ -217,7 +197,6 @@ do
exit 1 exit 1
;; ;;
esac esac
done done
@@ -231,9 +210,7 @@ if [ "install" = "$MODE" ]; then
fi fi
settingUpYCM settingUpYCM
elif [ "uninstall" = "$MODE" ]; then elif [ "uninstall" = "$MODE" ]; then
removeVimrc removeVimrc
if [ "" = "$VIM_DIR" ]; then if [ "" = "$VIM_DIR" ]; then
@@ -243,10 +220,8 @@ elif [ "uninstall" = "$MODE" ]; then
fi fi
removeYCM removeYCM
$user apt clean $user apt clean
else else
echo "Wrong argument to --mode option"\ echo "Wrong argument to --mode option"\
"Use env_set.sh --help" "Use env_set.sh --help"
exit 1 exit 1