From f7b61d4509b04c1a1d08103669459ad7db871d7a Mon Sep 17 00:00:00 2001 From: shinlw <45729567+shinlw@users.noreply.github.com> Date: Thu, 26 May 2022 20:08:24 +0800 Subject: [PATCH 1/4] fix ycm compile --- install.sh | 79 +++++++++++++++++------------------------------------- 1 file changed, 25 insertions(+), 54 deletions(-) diff --git a/install.sh b/install.sh index eb202560..e8e1df9e 100755 --- a/install.sh +++ b/install.sh @@ -189,12 +189,12 @@ function compile_vim_on_ubuntu() libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 lua5.1-dev rm -rf ~/vim82 - git clone https://gitee.com/chxuan/vim82.git ~/vim82 + git clone https://github.com/vim/vim.git ~/vim82 cd ~/vim82 ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ - --enable-pythoninterp \ + --enable-python3interp \ --enable-perlinterp \ --enable-luainterp \ --enable-gui=gtk2 \ @@ -211,12 +211,12 @@ function compile_vim_on_debian() sudo apt-get install -y libncurses5-dev libncurses5 libgtk2.0-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 lua5.1-dev rm -rf ~/vim82 - git clone https://gitee.com/chxuan/vim82.git ~/vim82 + git clone https://github.com/vim/vim.git ~/vim82 cd ~/vim82 ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ - --enable-pythoninterp \ + --enable-python3interp \ --enable-perlinterp \ --enable-luainterp \ --enable-gui=gtk2 \ @@ -233,12 +233,12 @@ function compile_vim_on_parrot() sudo apt-get install -y libncurses5-dev libncurses5 libgtk2.0-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 vim rm -rf ~/vim82 - git clone https://gitee.com/chxuan/vim82.git ~/vim82 + git clone https://github.com/vim/vim.git ~/vim82 cd ~/vim82 ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ - --enable-pythoninterp \ + --enable-python3interp \ --enable-perlinterp \ --enable-luainterp \ --enable-gui=gtk2 \ @@ -260,13 +260,13 @@ function compile_vim_on_centos() perl-ExtUtils-Embed libX11-devel ncurses-devel rm -rf ~/vim82 - git clone https://gitee.com/chxuan/vim82.git ~/vim82 + git clone https://github.com/vim/vim.git ~/vim82 cd ~/vim82 ./configure --with-features=huge \ --enable-multibyte \ --with-tlib=tinfo \ --enable-rubyinterp=yes \ - --enable-pythoninterp=yes \ + --enable-python3interp=yes \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-gui=gtk2 \ @@ -282,7 +282,7 @@ function install_prepare_software_on_mac() { xcode-select --install - brew install vim gcc cmake ctags-exuberant ack + brew install vim gcc cmake universal-ctags ack macos1014=$(is_macos1014) if [ $macos1014 == 1 ]; then @@ -330,7 +330,7 @@ function install_prepare_software_on_ubuntu() sudo apt-get install -y build-essential python python-dev python3-dev fontconfig libfile-next-perl ack-grep git sudo apt-get install -y universal-ctags || sudo apt-get install -y exuberant-ctags - if [ $version -ge 18 ];then + if [ $version -ge 20 ];then sudo apt-get install -y vim else compile_vim_on_ubuntu @@ -359,7 +359,7 @@ function install_prepare_software_on_debian() function install_prepare_software_on_parrot() { sudo apt-get update - sudo apt-get install -y cmake exuberant-ctags build-essential python python-dev python3-dev fontconfig libfile-next-perl ack git + sudo apt-get install -y cmake universal-ctags build-essential python python-dev python3-dev fontconfig libfile-next-perl ack git compile_vim_on_parrot } @@ -487,45 +487,22 @@ function install_vim_plugin() # 安装ycm插件 function install_ycm() { - git clone https://gitee.com/chxuan/YouCompleteMe-clang.git ~/.vim/plugged/YouCompleteMe + git clone --recurse-submodules https://github.com/ycm-core/YouCompleteMe.git ~/.vim/plugged/YouCompleteMe cd ~/.vim/plugged/YouCompleteMe distro=`get_linux_distro` - read -p "Please choose to compile ycm with python2 or python3, if there is a problem with the current selection, please choose another one. [2/3] " version - if [[ $version == "2" ]]; then - echo "Compile ycm with python2." - # alpine 忽略 --clang-completer 并将 let g:ycm_clangd_binary_path 注入 .vimrc - { - if [ ${distro} == "Alpine" ]; then - echo "##########################################" - echo "Apline Build, need without GLIBC." - echo "##########################################" - sed -i "273ilet g:ycm_clangd_binary_path='/usr/bin/clang'" ~/.vimrc - python2.7 ./install.py - return - fi - } || { - python2.7 ./install.py --clang-completer - } || { - echo "##########################################" - echo "Build error, trying rebuild without Clang." - echo "##########################################" - python2.7 ./install.py - } + echo "Compile ycm with python3." + # alpine 忽略 --clang-completer 并将 let g:ycm_clangd_binary_path 注入 .vimrc + if [ ${distro} == "Alpine" ]; then + echo "##########################################" + echo "Alpine Build, need without GLIBC." + echo "##########################################" + sed -i "273ilet g:ycm_clangd_binary_path='/usr/bin/clang'" ~/.vimrc + python3 ./install.py + return else - echo "Compile ycm with python3." { - # alpine 跳过该步骤 - if [ ${distro} == "Alpine" ]; then - echo "##########################################" - echo "Apline Build, need without GLIBC." - echo "##########################################" - sed -i "273ilet g:ycm_clangd_binary_path='/usr/bin/clang'" ~/.vimrc - python3 ./install.py - return - fi - } || { - python3 ./install.py --clang-completer + python3 ./install.py --clangd-completer } || { echo "##########################################" echo "Build error, trying rebuild without Clang." @@ -538,18 +515,12 @@ function install_ycm() # 在android上安装ycm插件 function install_ycm_on_android() { - git clone https://gitee.com/chxuan/YouCompleteMe-clang.git ~/.vim/plugged/YouCompleteMe + git clone --recurse-submodules https://github.com/ycm-core/YouCompleteMe.git ~/.vim/plugged/YouCompleteMe cd ~/.vim/plugged/YouCompleteMe - read -p "Please choose to compile ycm with python2 or python3, if there is a problem with the current selection, please choose another one. [2/3] " version - if [[ $version == "2" ]]; then - echo "Compile ycm with python2." - python2.7 ./install.py --clang-completer --system-libclang - else - echo "Compile ycm with python3." - python3 ./install.py --clang-completer --system-libclang - fi + echo "Compile ycm with python3." + python3 ./install.py --clangd-completer --system-libclang } # 打印logo From 384949fefa43b9d8769bcd5cfc7e43068dc8e7b6 Mon Sep 17 00:00:00 2001 From: shinlw <45729567+shinlw@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:06:32 +0800 Subject: [PATCH 2/4] Delete .ycm_extra_conf.py --- .ycm_extra_conf.py | 174 --------------------------------------------- 1 file changed, 174 deletions(-) delete mode 100644 .ycm_extra_conf.py diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py deleted file mode 100644 index eb302d68..00000000 --- a/.ycm_extra_conf.py +++ /dev/null @@ -1,174 +0,0 @@ -# This file is NOT licensed under the GPLv3, which is the license for the rest -# of YouCompleteMe. -# -# Here's the license text for this file: -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# For more information, please refer to - -import os -import ycm_core - -# These are the compilation flags that will be used in case there's no -# compilation database set (by default, one is not set). -# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. -flags = [ -'-Wall', -'-Wextra', -# '-Werror', -'-Wno-long-long', -'-Wno-variadic-macros', -'-fexceptions', -'-DNDEBUG', -# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM -# source code needs it. -'-DUSE_CLANG_COMPLETER', -# THIS IS IMPORTANT! Without a "-std=" flag, clang won't know which -# language to use when compiling headers. So it will guess. Badly. So C++ -# headers will be compiled as C headers. You don't want that so ALWAYS specify -# a "-std=". -# For a C project, you would set this to something like 'c99' instead of -# 'c++11'. -'-std=c++17', -# ...and the same thing goes for the magic -x option which specifies the -# language that the files to be compiled are written in. This is mostly -# relevant for c++ headers. -# For a C project, you would set this to 'c' instead of 'c++'. -'-x', -'c++', - -# c/c++ include path -'-isystem', -'/usr/include/c++/4.8', -'-isystem', -'/usr/include/c++/4.8.5', -'-isystem', -'/usr/include/c++/4.9.3', -'-isystem', -'/usr/include/c++/5', -'-isystem', -'/usr/include/c++/6', -'-isystem', -'/usr/include/c++/7', -'-isystem', -'/usr/include/c++/8', -'-isystem', -'/usr/include/c++/9', -'-isystem', -'/usr/include/c++/9.1.0', -'-isystem', -'/usr/include/c++/9.3.0', -'-isystem', -'/usr/include/c++/10.2.0', -'-isystem', -'/usr/include', -'-isystem', -'/usr/include/x86_64-linux-gnu', -'-isystem', -'/usr/local/include', - -# Termux -'-isystem', -'/data/data/com.termux/files/usr/include', -'-isystem', -'/data/data/com.termux/files/usr/include/c++/v1', -'-isystem', -'/data/data/com.termux/files/usr/include/c++/v1/experimental', -] - - -# Set this to the absolute path to the folder (NOT the file!) containing the -# compile_commands.json file to use that instead of 'flags'. See here for -# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html -# -# You can get CMake to generate this file for you by adding: -# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) -# to your CMakeLists.txt file. -# -# Most projects will NOT need to set this to anything; you can just change the -# 'flags' list of compilation flags. Notice that YCM itself uses that approach. -compilation_database_folder = '' - -if os.path.exists( compilation_database_folder ): - database = ycm_core.CompilationDatabase( compilation_database_folder ) -else: - database = None - -SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] - -def DirectoryOfThisScript(): - return os.path.dirname( os.path.abspath( __file__ ) ) - - -def IsHeaderFile( filename ): - extension = os.path.splitext( filename )[ 1 ] - return extension in [ '.h', '.hxx', '.hpp', '.hh' ] - - -def GetCompilationInfoForFile( filename ): - # The compilation_commands.json file generated by CMake does not have entries - # for header files. So we do our best by asking the db for flags for a - # corresponding source file, if any. If one exists, the flags for that file - # should be good enough. - if IsHeaderFile( filename ): - basename = os.path.splitext( filename )[ 0 ] - for extension in SOURCE_EXTENSIONS: - replacement_file = basename + extension - if os.path.exists( replacement_file ): - compilation_info = database.GetCompilationInfoForFile( - replacement_file ) - if compilation_info.compiler_flags_: - return compilation_info - return None - return database.GetCompilationInfoForFile( filename ) - - -def FlagsForFile( filename, **kwargs ): - if not database: - return { - 'flags': flags, - 'include_paths_relative_to_dir': DirectoryOfThisScript() - } - - compilation_info = GetCompilationInfoForFile( filename ) - if not compilation_info: - return None - - # Bear in mind that compilation_info.compiler_flags_ does NOT return a - # python list, but a "list-like" StringVec object. - final_flags = list( compilation_info.compiler_flags_ ) - - # NOTE: This is just for YouCompleteMe; it's highly likely that your project - # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR - # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. - try: - final_flags.remove( '-stdlib=libc++' ) - except ValueError: - pass - - return { - 'flags': final_flags, - 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_ - } From 0918770606783582ad00058fcbf3341f8865d01a Mon Sep 17 00:00:00 2001 From: shinlw <45729567+shinlw@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:14:41 +0800 Subject: [PATCH 3/4] Create .ycm_extra_conf.py update directories for header files --- .ycm_extra_conf.py | 246 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 .ycm_extra_conf.py diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 00000000..c21d2f99 --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,246 @@ +# This file is NOT licensed under the GPLv3, which is the license for the rest +# of YouCompleteMe. +# +# Here's the license text for this file: +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# For more information, please refer to + +from sysconfig import get_path +import platform +import os.path as p +import subprocess + +DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) ) +DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' ) +DIR_OF_WATCHDOG_DEPS = p.join( DIR_OF_THIRD_PARTY, 'watchdog_deps' ) +SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] + +database = None + +# These are the compilation flags that will be used in case there's no +# compilation database set (by default, one is not set). +# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. +flags = [ +'-Wall', +'-Wextra', +'-Werror', +'-Wno-long-long', +'-Wno-variadic-macros', +'-fexceptions', +'-DNDEBUG', +# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags; +# only the YCM source code needs it. +'-DUSE_CLANG_COMPLETER', +'-DYCM_EXPORT=', +'-DYCM_ABSEIL_SUPPORTED', +# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to +# use when compiling headers. So it will guess. Badly. So C++ headers will be +# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag. +# For a C project, you would set this to 'c' instead of 'c++'. +'-x', +'c++', +'-std=c++17', + +# AArch64 +'-isystem', + '/usr/include/c++/11', +'-isystem', + '/usr/include/aarch64-linux-gnu/c++/11', +'-isystem', + '/usr/include/c++/11/backward', +'-isystem', + '/usr/lib/gcc/aarch64-linux-gnu/11/include', +'-isystem', + '/usr/local/include', +'-isystem', + '/usr/include/aarch64-linux-gnu', +'-isystem', + '/usr/include', + +# c/c++ include path +'-isystem', +'/usr/include/c++/4.8', +'-isystem', +'/usr/include/c++/4.8.5', +'-isystem', +'/usr/include/c++/4.9.3', +'-isystem', +'/usr/include/c++/5', +'-isystem', +'/usr/include/c++/6', +'-isystem', +'/usr/include/c++/7', +'-isystem', +'/usr/include/c++/8', +'-isystem', +'/usr/include/c++/9', +'-isystem', +'/usr/include/c++/9.1.0', +'-isystem', +'/usr/include/c++/9.3.0', +'-isystem', +'/usr/include/c++/10.2.0', +'-isystem', +'/usr/include/x86_64-linux-gnu', + +# Termux +'-isystem', +'/data/data/com.termux/files/usr/include', +'-isystem', +'/data/data/com.termux/files/usr/include/c++/v1', +'-isystem', +'/data/data/com.termux/files/usr/include/c++/v1/experimental', +] + +# Set this to the absolute path to the folder (NOT the file!) containing the +# compile_commands.json file to use that instead of 'flags'. See here for +# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html +# +# You can get CMake to generate this file for you by adding: +# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) +# to your CMakeLists.txt file. +# +# Most projects will NOT need to set this to anything; you can just change the +# 'flags' list of compilation flags. Notice that YCM itself uses that approach. +compilation_database_folder = '' + + +def IsHeaderFile( filename ): + extension = p.splitext( filename )[ 1 ] + return extension in [ '.h', '.hxx', '.hpp', '.hh' ] + + +def FindCorrespondingSourceFile( filename ): + if IsHeaderFile( filename ): + basename = p.splitext( filename )[ 0 ] + for extension in SOURCE_EXTENSIONS: + replacement_file = basename + extension + if p.exists( replacement_file ): + return replacement_file + return filename + + +def PathToPythonUsedDuringBuild(): + try: + filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' ) + with open( filepath ) as f: + return f.read().strip() + except OSError: + return None + + +def Settings( **kwargs ): + # Do NOT import ycm_core at module scope. + import ycm_core + + global database + if database is None and p.exists( compilation_database_folder ): + database = ycm_core.CompilationDatabase( compilation_database_folder ) + + language = kwargs[ 'language' ] + + if language == 'cfamily': + # If the file is a header, try to find the corresponding source file and + # retrieve its flags from the compilation database if using one. This is + # necessary since compilation databases don't have entries for header files. + # In addition, use this source file as the translation unit. This makes it + # possible to jump from a declaration in the header file to its definition + # in the corresponding source file. + filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] ) + + if not database: + return { + 'flags': flags, + 'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT, + 'override_filename': filename + } + + compilation_info = database.GetCompilationInfoForFile( filename ) + if not compilation_info.compiler_flags_: + return {} + + # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # python list, but a "list-like" StringVec object. + final_flags = list( compilation_info.compiler_flags_ ) + + # NOTE: This is just for YouCompleteMe; it's highly likely that your project + # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR + # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. + try: + final_flags.remove( '-stdlib=libc++' ) + except ValueError: + pass + + return { + 'flags': final_flags, + 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_, + 'override_filename': filename + } + + if language == 'python': + return { + 'interpreter_path': PathToPythonUsedDuringBuild(), + 'ls': { + 'python': { + 'analysis': { + 'extraPaths': [ + p.join( DIR_OF_THIS_SCRIPT ), + p.join( DIR_OF_THIRD_PARTY, 'bottle' ), + p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), + p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), + p.join( DIR_OF_THIRD_PARTY, 'waitress' ) + ], + 'useLibraryCodeForTypes': True + } + } + } + } + + return {} + + +def PythonSysPath( **kwargs ): + sys_path = kwargs[ 'sys_path' ] + + sys_path[ 0:0 ] = [ p.join( DIR_OF_THIS_SCRIPT ), + p.join( DIR_OF_THIRD_PARTY, 'bottle' ), + p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), + p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), + p.join( DIR_OF_WATCHDOG_DEPS, + 'watchdog', + 'build', + 'lib3' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), + p.join( DIR_OF_THIRD_PARTY, 'waitress' ) ] + + sys_path.append( p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ) ) + return sys_path From aee06fdc83663dfc44831eb87329b5b5d1f44228 Mon Sep 17 00:00:00 2001 From: shinlw <45729567+shinlw@users.noreply.github.com> Date: Thu, 6 Jun 2024 01:34:09 +0800 Subject: [PATCH 4/4] Update install.sh Update features and packages Force Vim 9 for Copilot support Fix Perl support in Vim Simplify the code --- install.sh | 146 +++++++++++------------------------------------------ 1 file changed, 29 insertions(+), 117 deletions(-) diff --git a/install.sh b/install.sh index e8e1df9e..2ef5201d 100755 --- a/install.sh +++ b/install.sh @@ -174,74 +174,28 @@ function is_macos1014() fi } -# 在alpine上直装vim8.2 +# 在alpine上直装vim # function compile_vim_on_alpine() # { # apk --upgrade add vim # cd - # } -# 在ubuntu上源代码安装vim -function compile_vim_on_ubuntu() +# 在ubuntu系上源代码安装vim +function compile_vim_on_ubuntu_like() { - sudo apt-get install -y libncurses5-dev libncurses5 libgnome2-dev libgnomeui-dev \ - libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ - libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 lua5.1-dev + sudo apt-get install -y libncurses-dev libncurses6 libgtk-3-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python3-dev ruby-dev libperl-dev lua5.4 liblua5.4-dev - rm -rf ~/vim82 - git clone https://github.com/vim/vim.git ~/vim82 - cd ~/vim82 + rm -rf ~/vim-src + git clone https://github.com/vim/vim.git ~/vim-src + cd ~/vim-src ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp \ --enable-python3interp \ --enable-perlinterp \ --enable-luainterp \ - --enable-gui=gtk2 \ - --enable-cscope \ - --prefix=/usr - make - sudo make install - cd - -} - -# 在debian上源代码安装vim -function compile_vim_on_debian() -{ - sudo apt-get install -y libncurses5-dev libncurses5 libgtk2.0-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 lua5.1-dev - - rm -rf ~/vim82 - git clone https://github.com/vim/vim.git ~/vim82 - cd ~/vim82 - ./configure --with-features=huge \ - --enable-multibyte \ - --enable-rubyinterp \ - --enable-python3interp \ - --enable-perlinterp \ - --enable-luainterp \ - --enable-gui=gtk2 \ - --enable-cscope \ - --prefix=/usr - make - sudo make install - cd - -} - -# 在parrot上源代码安装vim -function compile_vim_on_parrot() -{ - sudo apt-get install -y libncurses5-dev libncurses5 libgtk2.0-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 vim - - rm -rf ~/vim82 - git clone https://github.com/vim/vim.git ~/vim82 - cd ~/vim82 - ./configure --with-features=huge \ - --enable-multibyte \ - --enable-rubyinterp \ - --enable-python3interp \ - --enable-perlinterp \ - --enable-luainterp \ - --enable-gui=gtk2 \ + --enable-gui=gtk3 \ --enable-cscope \ --prefix=/usr make @@ -253,15 +207,15 @@ function compile_vim_on_parrot() function compile_vim_on_centos() { sudo yum install -y ruby ruby-devel lua lua-devel luajit \ - luajit-devel ctags git python python-devel \ + luajit-devel ctags git \ python34 python34-devel tcl-devel \ perl perl-devel perl-ExtUtils-ParseXS \ perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \ perl-ExtUtils-Embed libX11-devel ncurses-devel - rm -rf ~/vim82 - git clone https://github.com/vim/vim.git ~/vim82 - cd ~/vim82 + rm -rf ~/vim-src + git clone https://github.com/vim/vim.git ~/vim-src + cd ~/vim-src ./configure --with-features=huge \ --enable-multibyte \ --with-tlib=tinfo \ @@ -300,7 +254,7 @@ function install_prepare_software_on_freebsd() function install_prepare_software_on_android() { pkg update - pkg install -y git vim-python cmake python2 python ctags ack-grep ncurses-utils + pkg install -y git vim-python cmake python ctags ack-grep ncurses-utils } # 安装alpine必备软件 需要更换源 @@ -319,21 +273,13 @@ function install_prepare_software_on_alpine() function install_prepare_software_on_ubuntu() { sudo apt-get update - - version=$(get_ubuntu_version) - if [ $version -eq 14 ];then - sudo apt-get install -y cmake3 - else - sudo apt-get install -y cmake - fi - - sudo apt-get install -y build-essential python python-dev python3-dev fontconfig libfile-next-perl ack-grep git - sudo apt-get install -y universal-ctags || sudo apt-get install -y exuberant-ctags + sudo apt-get install -y build-essential cmake python3-dev fontconfig libfile-next-perl ack git universal-ctags - if [ $version -ge 20 ];then + version=$(get_ubuntu_version) + if [ $version -ge 24 ];then sudo apt-get install -y vim else - compile_vim_on_ubuntu + compile_vim_on_ubuntu_like fi } @@ -341,26 +287,8 @@ function install_prepare_software_on_ubuntu() function install_prepare_software_on_ubuntu_like() { sudo apt-get update - sudo apt-get install -y cmake build-essential python python-dev python3-dev fontconfig libfile-next-perl ack-grep git - sudo apt-get install -y universal-ctags || sudo apt-get install -y exuberant-ctags - compile_vim_on_ubuntu -} - -# 安装debian必备软件 -function install_prepare_software_on_debian() -{ - sudo apt-get update - sudo apt-get install -y cmake build-essential python python-dev python3-dev fontconfig libfile-next-perl ack git - sudo apt-get install -y universal-ctags || sudo apt-get install -y exuberant-ctags - compile_vim_on_debian -} - -# 安装parrot必备软件 -function install_prepare_software_on_parrot() -{ - sudo apt-get update - sudo apt-get install -y cmake universal-ctags build-essential python python-dev python3-dev fontconfig libfile-next-perl ack git - compile_vim_on_parrot + sudo apt-get install -y build-essential cmake python3-dev fontconfig libfile-next-perl ack git universal-ctags + compile_vim_on_ubuntu_like } # 安装centos必备软件 @@ -369,9 +297,9 @@ function install_prepare_software_on_centos() version=$(get_centos_version) if [ $version -ge 8 ];then sudo dnf install -y epel-release - sudo dnf install -y vim ctags automake gcc gcc-c++ kernel-devel make cmake python2 python2-devel python3-devel fontconfig ack git + sudo dnf install -y vim ctags automake gcc gcc-c++ kernel-devel make cmake python3 python3-devel fontconfig ack git else - sudo yum install -y ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel fontconfig ack git + sudo yum install -y ctags automake gcc gcc-c++ kernel-devel cmake python3-devel fontconfig ack git compile_vim_on_centos fi } @@ -379,13 +307,13 @@ function install_prepare_software_on_centos() # 安装fedora必备软件 function install_prepare_software_on_fedora() { - sudo dnf install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel fontconfig ack git + sudo dnf install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python3-devel fontconfig ack git } # 安装archlinux必备软件 function install_prepare_software_on_archlinux() { - sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 ack git fontconfig + sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 ack git fontconfig sudo ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5 } @@ -420,7 +348,7 @@ function install_software_on_gentoo() # 安装opensuse必备软件 function install_prepare_software_on_opensuse() { - sudo zypper install -y vim ctags gcc gcc-c++ cmake python-devel python3-devel ack fontconfig git ncurses5-devel + sudo zypper install -y vim ctags gcc gcc-c++ cmake python3-devel ack fontconfig git ncurses5-devel } # 拷贝文件 @@ -601,22 +529,6 @@ function install_vimplus_on_ubuntu_like() begin_install_vimplus } -# 在debian上安装vimplus -function install_vimplus_on_debian() -{ - backup_vimrc_and_vim - install_prepare_software_on_debian - begin_install_vimplus -} - -# 在parrot上安装vimplus -function install_vimplus_on_parrot() -{ - backup_vimrc_and_vim - install_prepare_software_on_parrot - begin_install_vimplus -} - # 在centos上安装vimplus function install_vimplus_on_centos() { @@ -683,15 +595,15 @@ function install_vimplus_on_linux() elif [ ${distro} == "elementaryOS" ]; then install_vimplus_on_ubuntu_like elif [ ${distro} == "Debian" ]; then - install_vimplus_on_debian + install_vimplus_on_ubuntu_like elif [ ${distro} == "Raspbian" ]; then - install_vimplus_on_debian + install_vimplus_on_ubuntu_like elif [ ${distro} == "UOS" ]; then - install_vimplus_on_debian + install_vimplus_on_ubuntu_like elif [ ${distro} == "Kali" ]; then - install_vimplus_on_debian + install_vimplus_on_ubuntu_like elif [ ${distro} == "Parrot" ]; then - install_vimplus_on_parrot + install_vimplus_on_ubuntu_like elif [ ${distro} == "CentOS" ]; then install_vimplus_on_centos elif [ ${distro} == "fedora" ]; then