User talk:Andy: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Random Python Tricks)
Line 10: Line 10:
=== My VIM Settings ===
=== My VIM Settings ===


set nocompatible " We use a vim
<pre>
set noautoindent  
set nocompatible " We use a vim
set tabstop=2      " Tabs are two characters
set noautoindent
set shiftwidth=2    " Indents are two charactes too
set tabstop=2      " Tabs are two characters
set expandtab      " Do not use tabs
set shiftwidth=2    " Indents are two charactes too
"
set expandtab      " Do not use tabs
syntax on          " Turn on syntax hilighting
 
"
syntax on          " Turn on syntax hilighting
set hlsearch        " Hilight the search results
 
set incsearch      " Incrementally search. Like Emacs
set hlsearch        " Hilight the search results
set matchpairs+=<:> " Also match <> when pressing %
set incsearch      " Incrementally search. Like Emacs
set showmatch
 
set laststatus=2
set autochdir      " Automatically chdir to directory of the buffer
"
set matchpairs+=<:>
" Minimalistic gui
"set matchpairs+=<:>  
set guioptions-=T
set showmatch
set guioptions-=m
set laststatus=2
set guioptions+=f
set guioptions-=T
set guifont=Andale\ Mono\ 8
set guioptions-=m
"
set guioptions+=f
colorscheme darkblue
"set guifont=Fixed\ 11
"
"set guifont=Fixed\ 11
" Add spell checking
set viminfo+=n$HOME/.vim/viminfo
if exists("loaded_vimspell")
"set guifont=-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*
  set spell_auto_type="tex,mail,text,html,sgml,otl"
"set guifont=Andale\ Mono\ 8
  :SpellAutoEnable
 
endif
colorscheme darkblue
"
 
set wildmode=longest " Make tabcompletion behave correctly
amenu F&ont.&5x7            :set guifont=5x7<CR><C-L>
set selection=exclusive "  Only select up to not including last character
amenu F&ont.&6x10          :set guifont=6x10<CR><C-L>
set ignorecase " Ignore case when searching lowercase
amenu F&ont.6x13            :set guifont=6x13<CR><C-L>
set smartcase " Ignore case when searching lowercase
amenu F&ont.&7x13          :set guifont=7x13<CR><C-L>
"
amenu F&ont.&8x13          :set guifont=8x13<CR><C-L>
"
amenu F&ont.&9x15          :set guifont=9x15<CR><C-L>
set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " VTK, ITK style indenting
amenu F&ont.&10x20          :set guifont=10x20<CR><C-L>
"
amenu F&ont.&12x24          :set guifont=12x24<CR><C-L>
" Fix for Makefiles do tabs
amenu F&ont.&heabfix        :set guifont=-*-haebfix-medium-r-normal-*-15-*-*-*-*-*-*-*<CR><C-L>
:autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab
amenu F&ont.&lucida        :set guifont=-*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*<CR><C-L>
highlight SpellErrors  guibg=Red guifg=Black
 
 
 
if exists("loaded_vimspell")
  set spell_auto_type="tex,mail,text,html,sgml,otl"
  :SpellAutoEnable
endif
 
set wildmode=longest " Make tabcompletion behave correctly
set selection=exclusive "  Only select up to not including last character
set ignorecase " Ignore case when searching lowercase
set smartcase " Ignore case when searching lowercase
 
 
set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1
highlight SpellErrors guibg=Red guifg=Black
:autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab
highlight SpellErrors  guibg=Red guifg=Black
</pre>


== Random things that need to be put somewhere ==
== Random things that need to be put somewhere ==

Revision as of 22:22, 4 November 2004

VIM is a great editor

Ok, so I use VIM. I used to use Emacs, but I guess the starting time was bothering me. Also, for small sysadmin edits I used VIM already and I was mixing key strokes from Emacs and VIM.


My VIM Settings

set nocompatible " We use a vim
set noautoindent
set tabstop=2       " Tabs are two characters
set shiftwidth=2    " Indents are two charactes too
set expandtab       " Do not use tabs

syntax on           " Turn on syntax hilighting

set hlsearch        " Hilight the search results
set incsearch       " Incrementally search. Like Emacs

set autochdir       " Automatically chdir to directory of the buffer
set matchpairs+=<:>
"set matchpairs+=<:> 
set showmatch
set laststatus=2
set guioptions-=T
set guioptions-=m
set guioptions+=f
"set guifont=Fixed\ 11
"set guifont=Fixed\ 11
set viminfo+=n$HOME/.vim/viminfo
"set guifont=-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*
"set guifont=Andale\ Mono\ 8

colorscheme darkblue

amenu F&ont.&5x7            :set guifont=5x7<CR><C-L>
amenu F&ont.&6x10           :set guifont=6x10<CR><C-L>
amenu F&ont.6x13            :set guifont=6x13<CR><C-L>
amenu F&ont.&7x13           :set guifont=7x13<CR><C-L>
amenu F&ont.&8x13           :set guifont=8x13<CR><C-L>
amenu F&ont.&9x15           :set guifont=9x15<CR><C-L>
amenu F&ont.&10x20          :set guifont=10x20<CR><C-L>
amenu F&ont.&12x24          :set guifont=12x24<CR><C-L>
amenu F&ont.&heabfix        :set guifont=-*-haebfix-medium-r-normal-*-15-*-*-*-*-*-*-*<CR><C-L>
amenu F&ont.&lucida         :set guifont=-*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*<CR><C-L>



if exists("loaded_vimspell")
  set spell_auto_type="tex,mail,text,html,sgml,otl"
  :SpellAutoEnable
endif

set wildmode=longest " Make tabcompletion behave correctly
set selection=exclusive "  Only select up to not including last character
set ignorecase " Ignore case when searching lowercase
set smartcase " Ignore case when searching lowercase


set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1
highlight SpellErrors guibg=Red guifg=Black
:autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab
highlight SpellErrors  guibg=Red guifg=Black

Random things that need to be put somewhere

Random Python Tricks

How do I get a current line number or file name from the scrip?

import inspect

f = inspect.currentframe()
print "Line number: %d" % f.f_lineno
print "File name: %s" % f.f_code.co_filename

Also, you can go up the stack and do the same thing:

lineno = inspect.currentframe().f_back.f_lineno