Skip to content

Latest commit

 

History

History
559 lines (435 loc) · 25 KB

README.DEPRECATED.md

File metadata and controls

559 lines (435 loc) · 25 KB

My Vim Config


Content

ScreenShots:

Linux Terminal (html) :

Screenshot_Terminal

Linux Gvim (css):

Screenshot_Gvim

Windows Gvim (python)

Screenshot_Windows

PuTTy (vimrc)

Screenshot_PuTTy

Configuration

Usage

  • Windows User:

    • Copy vimrc from VimConfig\Configurations\vimrc into C:\Program Files\Vim, and rename vimrc to _vimrc

    • Get Vundle automatically

      • Open Vim and execute (Ignore warning and errors)

          :GetVundle
        
    • Get the other plugins

        :BundleInstall!
      
  • Linux User:

    • Copy vimrc from VimConfig/Configurations/vimrc into $HOME, and rename to .vimrc

        $ cp vimrc ~/.vimrc
      
    • Get Vundle and install plugins automatic:

        $ vim +GetVundle +BundleInstall +qa
        OR
        $ vim -c :GetVundle -c :BundleInstall -c :qa
      
    Setup Manually - Get [Vundle](https://github.com/gmarik/vundle.git) by command:
      <pre><code>$ cat .vimrc | grep "set rtp"
      set rtp+=$VIM/vimfiles/bundle/vundle
      set rtp+=~/.vim/bunle/vundle</code></pre>
    
    • Open Vim and Run (Ignore warnings and errors):

      :GetVundle
    • Get the other plugins by command:

      :BundleInstall!
  • Offline User:

    • For vimrc file
      • Windows User:
        • Copy vimrc from VimConfig\configureations\vimrc to C:\Program Files (x86)\Vim (64bit) or C:\Program Files\Vim (32bit), and rename to _vimrc
      • Linux User:
        • Copy vimrc from VimConfig/Configuations/vimrc into $HOME, and rename to .vimrc:

            $ cp VimConfig/Configurations/vimrc ~/.vimrc
          
        • OR: Create Link file to $HOME/.vimrc:

            $ ln -s <PATH_OF_VimConfig>/Configrations/vimrc ~/.vimrc
          
    • For bundle folder
      • Windows User: Copy bundle folder from VimConfig/Configurations/Offline_Packages/bundle to C:\Program Files (x86)\Vim (64bit) or C:\Program Files\Vim (Windows 32bit User)

      • Linux User: Copy bundle folder from VimConfig/Configureations/Offline_Packages/bundle to $HOME/.vim OR create link file

          $ cp -r VimConfig/Configureations/Offline_Package/bundle ~/.vim/
          OR
          $ ln -s <PATH_OF_VimConfig>/Configrations/Offline_Package/bundle ~/.vim/bundle
        

Open is Maximize

Shortcuts

  • F5: Run Python, Ruby and Perl by one key! (The result could be shown in the Quickfix window)
  • <leader>aid: Add the personal information

+++++++++++++++++++++++++++++++++++++++++++

  • Auto Pair
  • Auto compare code
    • <leader>fn: insert current file name
    • <leader>fe: insert current file name by suffix
    • <leader>tt: insert the current time
  • Save and load the fold information automatic

+++++++++++++++++++++++++++++++++++++++++++

  • Specified function shortcuts:
    • F12: Re-build tags file
    • gf: Goto File. Open file which under the cursor (Add the .py suffix while the filetype == python)
    • Alt + -: Reduce the font
    • Alt + +: Enlarge the font
    • cmd: Open command line and cd into the current file path
    • Alt + o: Open the current file browser

+++++++++++++++++++++++++++++++++++++++++++

  • Plugin shortcuts:
    • <leader>tl: Show the taglist
    • <leader>mm: Show winmanager
    • <leader>ta: Show Tagbar
    • <leader>v: Open the configure file (_vimrc in windows and .vimrc in Linux)
    • <leader>te: Open the Tetris
    • <leader>tv: Open bash in the vim/gvim against Liunxu and open command line against Windows (Yes! That's true)
    • <leader>u: Open Gundo window
    • pyli: Static Code Analysis for python <<-- obsolete. Use python-mode instead of
    • <leader>re: Open the most recently used files
    • <leader>x: Comments/Uncomments

+++++++++++++++++++++++++++++++++++++++++++

  • Emacs-style shortcuts:
    • Ctrl + a: Go to begin of the line [Normal Mode && Insert Mode]
    • Ctrl + e: Go to end of the line [Normal Mode && Insert Mode]
    • Alt + b: Backward a word [Insert Mode] <<-- obsolete
    • Alt + f: Forward a word [Insert Mode] <<-- obsolete
    • Alt + d: Delete a word (backward) [Insert Mode] <<-- obsolete
    • Ctrl + w: Delete a word (foreward) [Insert Mode]
    • Ctrl + d: Delete a char (backward) [Insert Mode] == [Delete]

+++++++++++++++++++++++++++++++++++++++++++

  • Patten shortcuts:
    • <leader>zdb: Delete Backspace. Delete the backspace at the each of each line
    • <leader>zhs: Delete Head Space. Delete all white space in the font of the line
    • <leader>zim: Insert Number. Insert the line number
    • <leader>zbl: Delete Blank Line. Delete the blank line
    • <leader>zdm: Delete M. Delete ^M ()
    • <leader>zng: Number Global. Show the number of searched words in last time
    • <leader>zbd: <200 b> Delete. Delete <200b> character
    • <leader>zdd: Delete Dot. Delete   character
    • <leader>zid: Insert Dot. Insert a dot (•)

Plugins:

Enhanced by Myself

For Python

For Ruby and RoR

Theme and colors

Not be used

+++++++++++++++++++++++++++++++++++++++++++

The default Font named: Monaco, download form: http://download.csdn.net/detail/jiaoxiaogu/4317959


###使用方法

  • Windows用户

    • 复制 Configurations\vimrcC:\Program Files (x86)\Vim, 且重命名为_vimrc

    • 自动获取 Vundle

      • 打开vim(忽略错误或警告)

        :GetVundle

    • 获取其他插件

      :BundleInstall!

  • Linux 用户:

    • 复制 Configurations/vimrc$HOME, 且重命名为.vimrc

      $ cp Configurateions/vimrc ~/.vimrc

    • 自动获取 Vundle

      • 打开Gvim且运行 (忽略错误或警告)

          :GetVundle
        
    • 获取其他插件

        :BundleInstall!
      
  • 离线用户 (无法使用git用户):

    • 对于vimrc 而言:

      • Windows用户: 复制 VimConig\Configurations\vimrcC:\Program Files (x86)\Vim (64位) 或 C:\Program Files\Vim (32位), 且重命名为_vimrc
      • Linux用户:
        • 复制 VimConfig/Configurations/vimrc$HOME, 且重命名为.vimrc

            $ cp VimConfig/Configurations/vimrc ~/.vimrc
          
        • 或创建link文件$HOME/.vimrc

            $ ln -s <PATH_OF_VimConfig>/Configrations/vimrc ~/.vimrc
          
    • 对于 bundle 目录

      • Windows用户: 复制 VimConfig/Configurations/Offline_Packages/bundle 目录到 C:\Program Files (x86)\Vim (64位) 或 C:\Program Files\Vim (32位)

      • Linux用户: 复制 VimConfig/Configureations/Offline_Packages/bundle$HOME/.vim 或创建链接文件

          $ cp -r VimConfig/Configureations/Offline_Package/bundle ~/.vim/
          OR
          $ ln -s <PATH_OF_VimConfig>/Configrations/Offline_Package/bundle ~/.vim/bundle
        

打开vim/gvim默认最大化

快捷键

  • F5: 一键运行Python, Ruby 和 Perl。(运行结果将显示在Quickfix窗口中)

+++++++++++++++++++++++++++++++++++++++++++

主题请看Screenshot

  • 自动配对
  • 自动添加信息:
    • fn: 添加当前文件名(无后缀,方便Java添加类名)
    • fe: 添加当前文件名(有后缀,方便添加注释)
    • tt: 添加当前时间
  • 自动保存和加载折叠信息

+++++++++++++++++++++++++++++++++++++++++++

  • 自定义函数快捷键
    • F12: 重新生成tags文件
    • gf: 打开光标下的单词为文件名 (若是python文件,则自动添加.py为后缀)
    • Alt + -: 缩小字体
    • Alt + +: 增大字体
    • cmd: 打开命令行,且自动cd到当前文件目录(Linux打开的为Terminal,Windows打开的为command line)
    • Alt + o: 打开文件浏览器, 且自动进入当前文档的目录 (Linux打开为Nautilus, Windows打开为Explorer)

+++++++++++++++++++++++++++++++++++++++++++

  • 插件快捷键
    • <leader>aid: 自动添加用户信息
    • <leader>tl: 显示taglist
    • <leader>mm: 显示winmanager(附带taglist信息)
    • <leader>ta: 显示Tagbar
    • <leader>v: 打开配置文件(_vimrc/.vimrc)
    • <leader>te: 打开俄罗斯方块游戏(练习hjkl快捷键)
    • <leader>tv: 在vim/gvim中运行bash(是的,你没看错!)
    • <leader>u: 打开Gundo窗口
    • pyli: Python静态代码分析(规范代码,远离砍手砍脚)
    • <leader>re: 打开最近文件列表(10个)
    • <leader>x: 注释/反注释

+++++++++++++++++++++++++++++++++++++++++++

  • Emacs 风格快捷键
    • Ctrl + a: 光标移动到行首 [Normal模式 && 插入模式]
    • Ctrl + e: 光标移动到行尾 [Normal模式 && 插入模式]
    • Alt + b: 光标向前跳动一个单词 [插入模式]
    • Alt + f: 光标向前跳动一个单词 [插入模式]
    • Alt + d: 向前删除一个单词 [插入模式]
    • Ctrl + w: 向后删除一个单词 [插入模式]
    • Ctrl + d: 向后删除一个字符 [插入模式]

+++++++++++++++++++++++++++++++++++++++++++

  • 正则表达式快捷键
    • <leader>zdb: Delete Backspace. 删除行尾空格
    • <leader>zhs: Delete Head Space. 删除行前空白(缩进,空格,等)
    • <leader>zim: Insert Number. 插入文档行号
    • <leader>zbl: Delete Blank Line. 删除空行
    • <leader>zdm: Delete M. 删除 ^M () 字符
    • <leader>zng: Number Global. 显示最后一次搜索内容的个数
    • <leader>zbd: <200**b**> Delete. 删除字符<200b>
    • <leader>zdd: Delete Dot. 删除 · 字符
    • <leader>zid: Insert Dot. 插入一个点 ()

插件列表:

我修改后的增强版

Python插件

Ruby和RoR插件

主题以及颜色

未被使用的(曾被使用)

+++++++++++++++++++++++++++++++++++++++++++

默认字体为: Monaco, 下载地址: http://download.csdn.net/detail/jiaoxiaogu/4317959

Compile VIM/GVIM by source code

In Linux(Ubuntu)

1. Prepare environment:

1.1. Downaload vim source code:

Download source from:

1.2. Install Necessary libs for GUI:

  • libatk1.0-dev
  • libbonoboui2-dev
  • libcairo2-dev
  • libgnome2-dev
  • libgnomeui-dev
  • libgtk2.0-dev
  • libncurses5-dev
  • libxpm-dev
  • libx11-dev
  • libxt-dev
Install necessary libs by the command as below:
$ sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev

2. Compile and Install:

2.1 Arugs:

  • Installation directories:
    • --prefix=PREFIX: install architecture-independent files in PREFIX Default directory: [/usr/local]
  • Optional Features:
    • --enable-gui=OPTS: X11 GUI default=auto OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon
    • --enable-gnome-check: If GTK GUI, check for GNOME default=no
    • --enable-fontset: Include X fontset output support
    • --enable-xim: Include XIM input support
    • --enable-cscope: Include cscope interface
    • --enable-pythoninterp=OPTS: Include Python interpreter. default=no OPTS=no/yes/dynamic
    • --enable-python3interp=OPTS: Include Python3 interpreter. default=no OPTS=no/yes/dynamic
    • --enable-rubyinterp=OPTS: Include Ruby interpreter. default=no OPTS=no/yes/dynamic
    • --enable-multibyte: Include multibyte editing support
  • Optional Packages:
    • --with-x: use the X Window System
    • --with-compiledby=NAME: name to show in :version message
    • --with-features=TYPE: tiny, small, normal, big or huge (default: normal)

2.2. Commands

$ cd vim
$ ./configure --with-x --enable-gui=gnome2 --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --enable-pythoninterp=yes --enable-rubyinterp=yes --enable-python3interp=yes --prefix=/home/marslo/Tools/Software/vim74/ --with-compiledby=Marslo --enable-gnome-check
$ make
$ sudo make install

2.3. Set the PATH

$ cat >> ~/.bashrc << EOF
> export PATH=/home/marslo/Tools/Software/vim74/:$PATH
> EOF
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 25 2013 15:31:13)
Included patches: 1-35
Compiled by Marslo
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
....

3. Make the compiled Gvim as the default text editor in Ubunut:

  • Copy applications/gvim.desktop and application/defaults.list to /usr/share/applications/:

    $ cp /usr/share/applications/defaults.list /usr/share/applications/defaults_bak.list`
      $ cp applications/gvim.desktop /usr/share/applications/
      $ cp -f applications/defaults.list /usr/share/applications/
  • Make gvim.desktop can find the gvim icon (it will be shown as bellow):

    $ cat gvim.desktop
      ...
      Icon=/home/marslo/Tools/Software/Vim/applications/gvim.png
      ...
  • An fully gvim.desktop

4. Reference:

4. Q&A

4.1 ncurses:

  • Problem:

      no terminal library found
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.
    
  • Soluction:

    • For Ubuntu/Debain:

        $ sudo apt-get install libncurses5-dev
      
    • For RHEL/CentOS:

        $ sudo yum install ncurses-devel
      

4.2 C compiler

  • Problem:

      no acceptable C compiler found in $PATH
    
  • Soluction:

    • For Ubuntu/Debain:

        $ sudo apt-get update && sudo apt-get install build-essential
      

4.3 Git clone https problem

  • Problem:

      "fatal: Unable to find remote helper for 'http'"
    
  • Soluction:

    • Fur Ubuntu/Debain:

        $ sudo apt-get install libcurl4-openssl-dev
      

In Windws (By Cygwin)

Mandatory Cygwin options

Command:

  • For GVIM:

      $ make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=yes
    
  • For VIM:

      $ make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
    
  • For Linux (RHEL) with python:

      $ LD_LIBRARY_PATH=/usr/local/lib/python2.7 PATH=/usr/local/bin:$PATH ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp=yes --with-python-config-dir=/usr/local/lib/python2.7/config/ --enable-rubyinterp=yes --with-features=huge --disable-smack --with-compiledby=marslo@appliance