Skip to content

ztbsuper/VimConfig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 automatically
      $ cat .vimrc | grep "set rtp"
            set rtp+=$VIM/vimfiles/bundle/vundle
            set rtp+=~/.vim/bunle/vundle
        
      • Open Vim and Run (Ignore warnings and errors):
        :GetVundle
    • Get the other plugins
      :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 /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 /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: 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
    • <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]
    • Alt + f: Forward a word [Insert Mode]
    • Alt + d: Delete a word (backward) [Insert Mode]
    • Ctrl + w: Delete a word (foreward) [Insert Mode]
    • Ctrl + d: Delete a char (backward) [Insert Mode] == [Delete]

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

  • Patten shortcuts:
    • zdb: Delete the backspace at the each of each line
    • zmm: Insert the line number
    • zws: Delete the blank line
    • zdm: Delete ^M ()
    • zng: Show the number of searched words in last time
    • zhh: Delete all white space in the font of the line

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 /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 /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: 向后删除一个字符 [插入模式]

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

  • 正则表达式快捷键
    • zdb: 删除行尾空格
    • zmm: 插入文档行号
    • zws: 删除空行
    • zdm: 删除^M
    • zng: 显示最后一次搜索内容的个数
    • zhh: 删除行前的空白(缩进,空格,等)

插件列表:

我修改后的增强版

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 git:

$ git clone https://github.com/b4winckler/vim.git

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
...

4. Q&A

4.1 ncurses:

  • Problem:
    You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.
      
  • Soluction:
    $ sudo apt-get install libncurses5-dev
      

4.2 C compiler

  • Problem:
    no acceptable C compiler found in $PATH
  • Soluction:
    $ 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:
    sudo apt-get install libcurl4-openssl-dev

In Windws (By Cygwin)

Mandatory Cygwin options

  • Dev stuff:

Command:

  • For GVIM:
    $ make -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgram/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgram/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=yes
      
  • For VIM:
    $  make -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgram/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgram/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
      

About

My Vim configuratons

Resources

Stars

Watchers

Forks

Packages

No packages published