@@ -5,6 +5,7 @@ set -o pipefail -E -e -u
55readonly FALSE=0
66readonly TRUE=1
77
8+ dotfiles_repo_path=" $( dirname " $( realpath " $0 " ) " ) "
89is_force_setup=${FALSE}
910is_install_pkg=${FALSE}
1011
@@ -32,8 +33,8 @@ OPTIONS
3233 Requirement: Optional
3334
3435 --install-pkg
35- Install packages on supported OSs. Symlinking (setup) will be done
36- after package installation.
36+ Install packages and plugin-extras on supported OSs. Symlinking (setup)
37+ will be done after package installation.
3738 Requirement: Optional, but note that some Vim plugins depend on packages
3839 to be installed to work.
3940 Installed packages: bear, build-essential, clang-format, cmake, curl, git,
@@ -56,6 +57,34 @@ REPORTING BUGS
5657"
5758}
5859
60+ # Install Bash Language Server for YouCompleteMe Vim plugin
61+ add_youcompleteme_extra_support () {
62+ lsp_dir=" ${dotfiles_repo_path} /lsp-examples"
63+ vimrc_path=" ${dotfiles_repo_path} /.vimrc"
64+ curr_vimrc_last_line=" $( tail --lines=1 " ${vimrc_path} " ) "
65+ vimrc_line_to_add=" source ${lsp_dir} /vimrc.generated"
66+
67+ if [[ -d " ${lsp_dir} " ]]; then
68+ rm -rf " ${lsp_dir} "
69+ fi
70+
71+ if [[ " ${curr_vimrc_last_line} " == " ${vimrc_line_to_add} " ]]; then
72+ head --lines=-1 " ${vimrc_path} " > " ${dotfiles_repo_path} /temp.vimrc" \
73+ && mv " ${dotfiles_repo_path} /temp.vimrc" " ${vimrc_path} "
74+ fi
75+
76+ git clone https://github.com/ycm-core/lsp-examples.git " ${lsp_dir} "
77+
78+ curr_dir=" $( pwd) "
79+ cd " ${lsp_dir} " && ./install.py " --enable-bash"
80+ cd " ${curr_dir} "
81+
82+ echo " ${vimrc_line_to_add} " >> " ${dotfiles_repo_path} /.vimrc"
83+
84+ echo " "
85+ echo " Above line added to .vimrc!"
86+ }
87+
5988# Handle command-line arguments
6089if [[ " $# " -gt 0 ]]; then
6190 while [[ " $# " -gt 0 ]]; do
@@ -82,10 +111,7 @@ if [[ "$#" -gt 0 ]]; then
82111 done
83112fi
84113
85- # Set dotfiles repository directory path
86- dotfiles_repo_path=" $( dirname " $( realpath " $0 " ) " ) "
87-
88- # Install packages
114+ # Install packages and plugin-extras
89115if [[ " ${is_install_pkg} " == " ${TRUE} " ]]; then
90116 if command -v " apt-get" ; then
91117 echo " "
@@ -97,8 +123,10 @@ if [[ "${is_install_pkg}" == "${TRUE}" ]]; then
97123 git man net-tools nodejs npm python3 python3-dev shellcheck shfmt \
98124 tmux vim
99125
126+ add_youcompleteme_extra_support
127+
100128 echo " "
101- echo " Package installation complete!"
129+ echo " Package and plugin-extras installation complete!"
102130 echo " "
103131 else
104132 echo " "
@@ -118,6 +146,7 @@ file_list=$(ls -A "${dotfiles_repo_path}")
118146for file_name in ${file_list} ; do
119147 if [[ (" ${file_name: 0: 1} " ! = " ." ) ||
120148 (" ${file_name} " == " .git" ) ||
149+ (" ${file_name} " == " .gitignore" ) ||
121150 (" ${file_name} " == * " .swp" ) ]]; then
122151 continue
123152 fi
0 commit comments