|
I've been programming in Python for about 2 years now and there are a few things I have learned along the way. One of the things I learned is..... How do I make my life easier???
One way is to customize your Python environment. This is quite easy to do! All you need to do is to create a pythonstartup file in your home directory.
Example... /home/dynasty/.pythonstartup
import readline import rlcompleter import os import atexit import os readline.parse_and_bind('tab: complete') histfile = os.path.join(os.environ['HOME'], '.pythonhistory') try: readlne.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file, histfile)
The above code will give you tab completion of your python modules. Which will save you so much time, here is an example...
>>> sys. Display all 224 possibilities? (y or n) sys.__class__ sys.exit sys.__delattr__ sys.exitfunc sys.__dict__ sys.getcheckinterval sys.__displayhook__ sys.getdefaultencoding sys.__doc__ sys.getdlopenflags sys.__egginsert sys.getfilesystemencoding sys.__excepthook__ sys.getrecursionlimit sys.__getattribute__ sys.getrefcount sys.__hash__ sys.hexversion sys.__init__ sys.last_traceback sys.__name__ sys.last_type sys.__new__ sys.last_value sys.__plen sys.maxint sys.__reduce__ sys.maxunicode sys.__reduce_ex__ sys.meta_path sys.__repr__ sys.modules sys.__setattr__ sys.path sys.__stderr__ sys.path_hooks sys.__stdin__ sys.path_importer_cache sys.__stdout__ sys.platform sys.__str__ sys.prefix sys._current_frames sys.ps1 sys._getframe sys.ps2
Now that you have your Python environment ready we now need to get your VIM environment ready as well. For those of you who do not know what VIM is, it is an editor or should I say THE EDITOR. Now if you are running any distro of Linux you are sure to have VIM. For those of you who do not have VIM.... GETTTT ITTTT!!! :)
Once you know that you have vim, lets go ahead and create a vimrc file. For example /home/dynasty/.vimrc
set encoding=utf8 set paste set expandtab set textwidth=0 set tabstop=4 set softtabstop=4 set shiftwidth=4 set autoindent set backspace=indent,eol,start set incsearch set ignorecase set ruler set wildmenu set foldlevel=0 set clipboard+=unnamed syntax on
Now your vim environment is good and ready to go. If you need to know what each of those values mean all you need to do is run vim and
type :help <value_name>
|