Showing posts with label vi. Show all posts
Showing posts with label vi. Show all posts

Sunday, 25 September 2016

Make VIM into an IDE



(1) ctags

$sudo apt-get install exuberant-ctags

> Now go to the directory with the source files, go into it, not one level out it. And use:
    $ctags -R *

  -R indicates recursively, which means the subdirectories are also searched. And we can see a new file naned "tags".

Here are some useful cmds for ctags:

Ctrl + ]
Ctrl + t
:tag function_name 
:ta function_name












ref:
http://blog.csdn.net/daniel_ustc/article/details/8299096
https://andrew.stwrt.ca/posts/vim-ctags/



Friday, 23 October 2015

VIM color scheme

With "syntax on" command in configuration file "~/.vimrc", the color scheme is really unacceptable for a programmer...

There are many beautiful alternatives. Some commonly used color scheme conf files can be find in Ubuntu directary: "/usr/share/vim/vim7x/colors/" such as desert.vim and morning.vim.

We only need to, in ~/.vimrc, add:
                  colo desert 
                  syntax on

...much better now!

But if you would like to use other color conf downloaded from somewhere else, you have to put the "xxxx.vim" file under the above directary so that vi could locate it automatically.

Hope it helps!

Friday, 16 October 2015

vi getting multiple “Sorry, the command is not available in this version…”

Just re-installed Ubuntu, but I am getting the following error codes when launching vi...I am using the configuration from:
    http://jsdelfino.blogspot.ca/2010/11/my-vi-configuration-file.html

Error detected while processing /home/boris/.vimrc:
line   30:
E518: Unknown option: autochdir
line   39:
E319: Sorry, the command is not available in this version: syntax on
line   43:
E319: Sorry, the command is not available in this version: filetype indent on
line   64:
E319: Sorry, the command is not available in this version: function! RESTORE_CURSOR()
line   68:
E319: Sorry, the command is not available in this version: endfunction
line   69:
E319: Sorry, the command is not available in this version: autocmd BufReadPost * call RESTORE_CURSOR()
Press ENTER or type command to continue


Soved by using suggestions from this bbs:

Try from within vim ...
:version
and if your get ...
Small version without GUI.
You are missing package vim-gui-common. It is probably also advisable to install vim-runtime. Commands to install:
sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime

Another cause might be that alternatives is pointing to the wrong one:
update-alternatives --display vim
to show what is used and ...
update-alternatives --config vim
to change to another vim. It could be that /usr/bin/vim.gnome is used and you need /usr/bin/vim

########################################################
It worked for me right after I installed vim-gui-common:
sudo apt-get install vim-gui-common


Hope this helps!