Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Saturday, February 18, 2012

VIM editor line numbering

If you are fan of VI editor, here is the trick how you can enable the line numbering,

below is your normal presentation when you do vi


#define your item pipelines here
from scrapy.exceptions import DropItem
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/topics/item-pipeline.html

class newsPipeline(object):
    def process_item(self, item, spider):
...........

1. hit esc
2. enter - :set rnu

result -

  0 #define your item pipelines here
  1 from scrapy.exceptions import DropItem
  2 # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  3 # See: http://doc.scrapy.org/topics/item-pipeline.html
  4
  5 class newsPipeline(object):
  6     def process_item(self, item, spider):

  7 ......

if you want to revert to the original settings..
1. hit esc
2. enter - :set nornu


Saturday, February 11, 2012

Python color syntax highlighting

If you open python file first time on your terminal, it will be plain black color text. To enable the color highlighting follow below steps -

  • open the file - vi myProg.py
  • hit esc (escape) - : syntax on

It will enable the color highlighting, which will be helpful to recognize any syntactical error.

To enable the highlighting permanent follow below steps -

  • open the file - vi ~/.vimrc
  • hit i > it will enable the insert mode
  • type - syntax on
  • hit esc (escape) - :wq
open the python file in vi and check the syntax.