set nocompatible
set backspace=indent,eol,start
set nobackup
set mouse=a
set confirm
" Windows settings
source $VIMRUNTIME/mswin.vim
behave mswin
" Turn off bells and flashes
set noerrorbells
if has('autocmd')
autocmd GUIEnter * set vb t_vb=
endif
" Font and color scheme
"set gfn=Consolas:h10:cANSI
set gfn=Inconsolata:h10:cANSI
"colorscheme fruity
colorscheme wombat
" Detect filetype and use syntax highlighting
filetype on
filetype plugin on
syntax on
" Keep a bunch of command line history
set history=1000
" Save swap files centrally if possible
set dir=c:\\temp
" Show the cursor position and line numbers
set ruler
set number
" Show incomplete commands and enable wild menu
set showcmd
set wildmenu
set wildmode=list:longest
" Enable incremental search but don't highlight matches
set incsearch
set nohlsearch
" Key binding F2 to toggle search highlighting
map <silent> <F2> :set invhlsearch<CR>
" Smart case sensitivity
set ignorecase
set smartcase
" Use spaces instead of tabs
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
"Enabled auto-indenting
set autoindent
set smartindent
filetype plugin indent on
" Hide toolbar and menubar
set guioptions-=T
set guioptions-=m
" Leave some space at the bottom
set scrolloff=2
" Show matching brace
set showmatch
" Use Windows clipboard
set clipboard+=unnamed
" Set default window size
set lines=50 columns=100
" Don't wrap lines
set nowrap
" Speed optimizations
set lz
set ttyfast
" Automatically set current directory to file's location
set autochdir
" Permit changing buffers without saving
set hidden
" Folding
set foldmethod=marker
" Show tabs and trailing spaces so I can remove them
set list
set listchars=tab:»·,trail:·
" Save/Reload session
set sessionoptions=blank,buffers,curdir,folds,help,resize,tabpages,winsize
nmap <silent> <leader>ss <Esc>:mksession! $VIM/.session<CR>
nmap <silent> <leader>ls <Esc>:source $VIM/.session<CR>
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
" NERDTree settings (launch with \nt or \\)
let g:NERDTreeQuitOnOpen = 1
nmap <silent> <leader>nt <Esc>:NERDTreeToggle<CR>
nmap <silent> <leader>\ <Esc>:NERDTreeToggle<CR>
" bufexplorer settings (launch with \be or \])
nmap <silent> <unique> <leader>] <Esc>:BufExplorer<CR>
" Tab navigation
nmap <silent> <C-t> :tabnew<CR>
nmap <silent> <C-j> gT
nmap <silent> <C-k> gt
nmap <silent> <C-h> :tabfirst<CR>
nmap <silent> <C-l> :tablast<CR>
nmap <silent> <leader>ta <Esc>:tab ball<CR>
" Split window navigation
nmap <c-down> <c-w>w
nmap <c-up> <c-w>W
nmap <c-left> <c-w>h
nmap <c-right> <c-w>l
" Undo in Insert mode (CTRL+Z)
map <c-z> <c-o>u
" Remap omni-completion to CTRL+SPACE
inoremap <C-space> <C-x><C-o>
" Most recently used file list settings
let MRU_Max_Entries = 50
" Use SQL Server syntax file for .sql files
let g:sql_type_default = "sqlserver"
" Functions for cleaning up tabs and spaces
function! RemoveTrailingSpaces()
%s/\s\+$//e
%s/
//ge
endfunction
function! ConvertTabsToSpaces()
%retab
endfunction
function! CleanFile()
call ConvertTabsToSpaces()
call RemoveTrailingSpaces()
endfunction
" Key binding \f to clean up file
nmap <silent> <leader>f <Esc>:call CleanFile()<CR>
" Format of GUI tab label
function! GuiTabLabel()
" add the tab number
let label = '['.tabpagenr()
" modified since the last save?
let buflist = tabpagebuflist(v:lnum)
for bufnr in buflist
if getbufvar(bufnr, '&modified')
let label .= '*'
break
endif
endfor
" count number of open windows in the tab
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
let label .= ', '.wincount
endif
let label .= '] '
" add the file name without path information
let n = bufname(buflist[tabpagewinnr(v:lnum) - 1])
let label .= fnamemodify(n, ':t')
return label
endfunction
set guitablabel=%{GuiTabLabel()}
" C-specific settings
set makeprg=gcc\ -o\ %<\ %
:command -nargs=* Make make <args> | cwindow 3
" Python-specific settings
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
autocmd FileType python set omnifunc=pythoncomplete#Complete
" Special functions for debugging/launching Python scripts
" http://www.petersblog.org/node/752
python << EOF
import vim
import string
def SetBreakpoint():
import re
nLine = int(vim.eval('line(".")'))
strLine = vim.current.line
strWhite = re.search('^(\s*)', strLine).group(1)
vim.current.buffer.append(
"%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" %
{'space':strWhite, 'mark': '#' * 30}, nLine - 1)
for strLine in vim.current.buffer:
if strLine == "import pdb":
break
else:
vim.current.buffer.append('import pdb', 0)
vim.command('normal j1')
vim.command('map <f7> :py SetBreakpoint()<cr>')
def RemoveBreakpoints():
import re
nCurrentLine = int(vim.eval('line(".")'))
nLines = []
nLine = 1
for strLine in vim.current.buffer:
if strLine == 'import pdb' or strLine.lstrip()[:15] == 'pdb.set_trace()':
nLines.append(nLine)
nLine += 1
nLines.reverse()
for nLine in nLines:
vim.command('normal %dG' % nLine)
vim.command('normal dd')
if nLine < nCurrentLine:
nCurrentLine -= 1
vim.command('normal %dG' % nCurrentLine)
vim.command('map <s-f7> :py RemoveBreakpoints()<cr>')
def RunDebugger():
vim.command('wall')
strFile = vim.eval("g:mainfile")
winos = vim.eval('has("win32")')
if string.atoi(winos):
vim.command("!start python -m pdb %s" % strFile)
else:
vim.command("!xterm -e python -m pdb %s&" % strFile)
def RunNormal():
vim.command('wall')
strFile = vim.eval('expand("%:p")')
winos = vim.eval('has("win32")')
if string.atoi(winos):
vim.command("!start python %s" % strFile)
else:
vim.command("!xterm -e python %s&" % strFile)
def RunNormalInDebugMode():
vim.command('wall')
strFile = vim.eval('expand("%:p")')
winos = vim.eval('has("win32")')
if string.atoi(winos):
vim.command("!start python %s --debug-mode" % strFile)
else:
vim.command("!xterm -e python %s --debug-mode&" % strFile)
vim.command('map <s-f12> :py RunDebugger()<cr>')
vim.command('map <f5> :py RunNormal()<cr>')
vim.command('map <s-f5> :py RunNormalInDebugMode()<cr>')
EOF
import org.osflash.thunderbolt.Logger;
var myNumber: int = 5;
var myString2: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);