" Window movement shortcuts " move to the window in the direction shown, or create a new window function! functions#WinMove(key) let t:curwin = winnr() exec "wincmd ".a:key if (t:curwin == winnr()) if (match(a:key,'[jk]')) wincmd v else wincmd s endif exec "wincmd ".a:key endif endfunction " smart tab completion function! functions#Smart_TabComplete() let line = getline('.') " current line let substr = strpart(line, -1, col('.')+1) " from the start of the current " line to one character right " of the cursor let substr = matchstr(substr, '[^ \t]*$') " word till cursor if (strlen(substr)==0) " nothing to match on empty string return '\' endif let has_period = match(substr, '\.') != -1 " position of period, if any let has_slash = match(substr, '\/') != -1 " position of slash, if any if (!has_period && !has_slash) return '\\' " existing text matching elseif ( has_slash ) return '\\' " file matching else return '\\' " plugin matching endif endfunction " execute a custom command function! functions#RunCustomCommand() up if g:silent_custom_command execute 'silent !' . s:customcommand else execute '!' . s:customcommand endif endfunction function! functions#SetCustomCommand() let s:customcommand = input('Enter Custom Command$ ') endfunction function! functions#TrimWhiteSpace() %s/\s\+$//e endfunction function! functions#HtmlUnEscape() silent s/<//eg silent s/&/\&/eg endfunction