Merge pull request #1 from staticsafe/this-is-a-damn-refactor

Merge refactor to master branch.
This commit is contained in:
staticsafe 2013-08-04 03:55:04 -07:00
commit 21ce8ee1ef
62 changed files with 26 additions and 8332 deletions

View File

@ -1 +0,0 @@
../plugin/minibufexpl.vim

View File

@ -1,105 +0,0 @@
"=============================================================================
" sonictemplate.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 08-Nov-2011.
let s:save_cpo = &cpo
set cpo&vim
if exists('g:sonictemplate_vim_template_dir')
let s:tmpldir = g:sonictemplate_vim_template_dir
else
let s:tmpldir = expand('<sfile>:p:h:h') . '/template/'
endif
function! sonictemplate#select(mode) abort
let name = input(':Template ', '', 'customlist,sonictemplate#complete')
if name == ''
return
endif
call sonictemplate#apply(name, a:mode)
endfunction
function! sonictemplate#complete(lead, cmdline, curpos) abort
if search('[^ \t]', 'wn')
return map(split(globpath(join([s:tmpldir, &ft], '/'), 'snip-' . a:lead . '*.*'), "\n"), 'fnamemodify(v:val, ":t:r")[5:]')
else
return map(split(globpath(join([s:tmpldir, &ft], '/'), 'base-' . a:lead . '*.*'), "\n"), 'fnamemodify(v:val, ":t:r")[5:]')
endif
endfunction
function! sonictemplate#apply(name, mode) abort
let buffer_is_not_empty = search('[^ \t]', 'wn')
if search('[^ \t]', 'wn')
let fs = split(globpath(join([s:tmpldir, &ft], '/'), 'snip-' . a:name . '.*'), "\n")
else
let fs = split(globpath(join([s:tmpldir, &ft], '/'), 'base-' . a:name . '.*'), "\n")
endif
if len(fs) == 0
echomsg 'Template '.a:name.' is not exists.'
return
endif
let f = fs[0]
if !filereadable(f)
echomsg 'Template '.a:name.' is not exists.'
return
endif
let c = join(readfile(f, "b"), "\n")
let c = substitute(c, '{{_name_}}', expand('%:t:r:'), 'g')
let tmp = c
let mx = '{{_input_:\(.\{-}\)}}'
let vars = []
while 1
let match = matchstr(tmp, mx)
if len(match) == 0
break
endif
let var = substitute(match, mx, '\1', 'ig')
if index(vars, var) == -1
call add(vars, var)
endif
let tmp = tmp[stridx(tmp, match) + len(match):]
endwhile
for var in vars
let val = input(var . ":")
let c = substitute(c, '\V{{_input_:'.var.'}}', '\=val', 'g')
endfor
sandbox let c = substitute(c, '{{_if_:\(.\{-}\);\(.\{-}\)\(;\(.\{-}\)\)\{-}}}', '\=eval(submatch(1))?submatch(2):submatch(4)', 'g')
sandbox let c = substitute(c, '{{_expr_:\(.\{-}\)}}', '\=eval(submatch(1))', 'g')
if len(c) == 0
return
endif
if !buffer_is_not_empty
silent! %d _
silent! put = c
silent! normal! ggdd
else
if c[len(c)-1] == "\n"
let c = c[:-2]
endif
let line = getline('.')
let indent = matchstr(line, '^\(\s*\)')
if line =~ '^\s*$' && line('.') != line('$')
silent! normal dd
endif
let c = indent . substitute(c, "\n", "\n".indent, 'g')
if len(indent) && (&expandtab || indent =~ '^ \+$')
let c = substitute(c, "\t", repeat(' ', min([len(indent), &tabstop])), 'g')
endif
silent! put! = c
endif
if stridx(c, '{{_cursor_}}') != -1
if a:mode == 'n'
silent! call search('\zs{{_cursor_}}', 'w')
silent! exe "normal ".repeat("x", 12)
else
silent! call search('{{_cursor_}}\zs', 'w')
call feedkeys(repeat("\<bs>", 12))
endif
endif
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et:

File diff suppressed because it is too large Load Diff

View File

@ -1,182 +0,0 @@
*sonictemplate-vim.txt* SonicTemplate for Vim
-------------------------------------------------------
SonicTemplate: hi speed coding method
-------------------------------------------------------
Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
WebSite: http://mattn.kaoriya.net/
Repository: http://github.com/mattn/sonictemplate-vim
Site: http://mattn.github.com/sonictemplate-vim
License: BSD style license
==============================================================================
CONTENTS *sonictemplate-vim-contents*
Introduction |sonictemplate-introduction|
Install |sonictemplate-install|
Tutorial |sonictemplate-tutorial|
Customize |sonictemplate-customize|
Write Your Template |sonictemplate-writetemplate|
==============================================================================
INTRODUCTION *sonictemplate-vim-introduction*
|SonicTemplate| is easy and high speed coding method.
* Choose template for the filetype
* Few typings.
* Flexible customization.
==============================================================================
INSTALL *sonictemplate-vim-install*
Install the distributed files into Vim runtime directory which is usually
~/.vim/, or $HOME/vimfiles on Windows.
If you install pathogen that provided from Tim Pope, you should extract the
file into 'bundle' directory.
==============================================================================
TUTORIAL *sonictemplate-vim-tutorial*
For example, you are writing C++ file.
1. Create main function
Open new C++ file, and type following.
>
:Template boost-main
<
Then you can see following.
>
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
int
main(int argc, char* argv[]) {
_
return 0;
}
<
The cursor is in the position of |_|.
2. Add foreach loop
Type following.
>
:Template boost-for
<
Then you will be asked like following.
>
variable:
<
Then type "foo".
>
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
int
main(int argc, char* argv[]) {
BOOST_FOREACH(auto x, foo) {
_
}
return 0;
}
<
3. Add std::cout << xxx << std::endl;
>
:Template cout
<
Answer "x" for the question "string:".
>
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
int
main(int argc, char* argv[]) {
BOOST_FOREACH(auto x, foo) {
std::cout << x << std::endl;
}
return 0;
}
<
==============================================================================
CUSTOMIZE *sonictemplate-vim-customize*
You can modify template directory for your-self templates.
>
let g:template_vim_template_dir = '/path/to/your/template/directory'
<
==============================================================================
WRITE YOUR TEMPLATE *sonictemplate-vim-writetemplate*
Templates are stored in the directory that "g:sonictemplate_vim_template_dir"
variable specified. On unix, directory structure is following.
Note that I'm using pathogen-vim.
>
~/.vim/bundle/sonictemplate-vim
plugin
sonictemplate.vim
doc
sonictemplate.txt
template
go ... filetype go
base-main.go ... base main
base-package.go ... base package
snip-goroutine.go ... snippet for goroutine
...
perl ... filetype perl
base-package.pl ... base package
base-script.pl ... base script
snip-dbi-connect-sqlite.pl ... snippet for DBI/SQLite
...
1. The filename have following rule.
|[kind]|-|[name]|.|[extension]|
|[kind]| 'base' or 'snip' should be used.
'base' is used when buffer is empty.
|[name]| template name
Words in the name must join with '-'.
|[extension]| file name extension like ".c".
If several extensions are exists in same directory, the first found is used.
2. Template can have some keywords.
|{{_name_}}| the filename without extension.
If you are opening "foo.pl" for perl, {{_name_}} become "foo".
|{{_cursor_}}| : cursor position.
When expanded template, cursor will be moved to there.
|{{_input_:var}}| : ask the value of "var".
When expanded template, cursor will be moved to there.
|{{_expr_:xxx}}| : expression in vimscript.
For example: "Current Time:|{{_expr_:strftime('%c')}}|" will be
>
Current Time: 2011/10/27 20:19:00
<
|{{_if_:expr;foo;bar}}| : ternary operator
For example: When today is saturday,
"Today is |{{_if_:strftime('%w')%6;OrdinaryDay;Holiday}}|" will be
>
Today is Holiday
<
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

View File

@ -1,41 +0,0 @@
" ============================================================================
" File: exec_menuitem.vim
" Description: plugin for NERD Tree that provides an execute file menu item
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 22 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_exec_menuitem")
finish
endif
let g:loaded_nerdtree_exec_menuitem = 1
call NERDTreeAddMenuItem({
\ 'text': '(!)Execute file',
\ 'shortcut': '!',
\ 'callback': 'NERDTreeExecFile',
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
function! NERDTreeExecFileActive()
let node = g:NERDTreeFileNode.GetSelected()
return !node.path.isDirectory && node.path.isExecutable
endfunction
function! NERDTreeExecFile()
let treenode = g:NERDTreeFileNode.GetSelected()
echo "==========================================================\n"
echo "Complete the command to execute (add arguments etc):\n"
let cmd = treenode.path.str({'escape': 1})
let cmd = input(':!', cmd . ' ')
if cmd != ''
exec ':!' . cmd
else
echo "Aborted"
endif
endfunction

View File

@ -1,224 +0,0 @@
" ============================================================================
" File: fs_menu.vim
" Description: plugin for the NERD Tree that provides a file system menu
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 17 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_fs_menu")
finish
endif
let g:loaded_nerdtree_fs_menu = 1
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
if has("gui_mac") || has("gui_macvim")
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
endif
if g:NERDTreePath.CopyingSupported()
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
endif
"FUNCTION: s:echo(msg){{{1
function! s:echo(msg)
redraw
echomsg "NERDTree: " . a:msg
endfunction
"FUNCTION: s:echoWarning(msg){{{1
function! s:echoWarning(msg)
echohl warningmsg
call s:echo(a:msg)
echohl normal
endfunction
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
"prints out the given msg and, if the user responds by pushing 'y' then the
"buffer with the given bufnum is deleted
"
"Args:
"bufnum: the buffer that may be deleted
"msg: a message that will be echoed to the user asking them if they wish to
" del the buffer
function! s:promptToDelBuffer(bufnum, msg)
echo a:msg
if nr2char(getchar()) ==# 'y'
exec "silent bdelete! " . a:bufnum
endif
endfunction
"FUNCTION: NERDTreeAddNode(){{{1
function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected()
let newNodeName = input("Add a childnode\n".
\ "==========================================================\n".
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
\ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
if newNodeName ==# ''
call s:echo("Node Creation Aborted.")
return
endif
try
let newPath = g:NERDTreePath.Create(newNodeName)
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
let newTreeNode = g:NERDTreeFileNode.New(newPath)
if parentNode.isOpen || !empty(parentNode.children)
call parentNode.addChild(newTreeNode, 1)
call NERDTreeRender()
call newTreeNode.putCursorHere(1, 0)
endif
catch /^NERDTree/
call s:echoWarning("Node Not Created.")
endtry
endfunction
"FUNCTION: NERDTreeMoveNode(){{{1
function! NERDTreeMoveNode()
let curNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Rename the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path for the node: \n" .
\ "", curNode.path.str(), "file")
if newNodePath ==# ''
call s:echo("Node Renaming Aborted.")
return
endif
try
let bufnum = bufnr(curNode.path.str())
call curNode.rename(newNodePath)
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
if bufnum != -1
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
call curNode.putCursorHere(1, 0)
redraw
catch /^NERDTree/
call s:echoWarning("Node Not Renamed.")
endtry
endfunction
" FUNCTION: NERDTreeDeleteNode() {{{1
function! NERDTreeDeleteNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let confirmed = 0
if currentNode.path.isDirectory
let choice =input("Delete the current node\n" .
\ "==========================================================\n" .
\ "STOP! To delete this entire directory, type 'yes'\n" .
\ "" . currentNode.path.str() . ": ")
let confirmed = choice ==# 'yes'
else
echo "Delete the current node\n" .
\ "==========================================================\n".
\ "Are you sure you wish to delete the node:\n" .
\ "" . currentNode.path.str() . " (yN):"
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
call currentNode.delete()
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
let bufnum = bufnr(currentNode.path.str())
if buflisted(bufnum)
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
redraw
catch /^NERDTree/
call s:echoWarning("Could not remove node")
endtry
else
call s:echo("delete aborted")
endif
endfunction
" FUNCTION: NERDTreeCopyNode() {{{1
function! NERDTreeCopyNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Copy the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path to copy the node to: \n" .
\ "", currentNode.path.str(), "file")
if newNodePath != ""
"strip trailing slash
let newNodePath = substitute(newNodePath, '\/$', '', '')
let confirmed = 1
if currentNode.path.copyingWillOverwrite(newNodePath)
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
let newNode = currentNode.copy(newNodePath)
if !empty(newNode)
call NERDTreeRender()
call newNode.putCursorHere(0, 0)
endif
catch /^NERDTree/
call s:echoWarning("Could not copy node")
endtry
endif
else
call s:echo("Copy aborted.")
endif
redraw
endfunction
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open -R '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open '" . treenode.path.str() . "'")
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
ERROR 2012-07-08T13:17:35 supybot Invalid user dictionary file, resetting to empty.
ERROR 2012-07-08T13:17:35 supybot Exact error: IOError: [Errno 2] No such file or directory: 'conf/users.conf'
ERROR 2012-07-08T13:17:45 supybot Invalid channel database, resetting to empty.
ERROR 2012-07-08T13:17:46 supybot Exact error: IOError: [Errno 2] No such file or directory: 'conf/channels.conf'
WARNING 2012-07-08T13:17:51 supybot Couldn't open ignore database: [Errno 2] No such file or directory: 'conf/ignores.conf'
INFO 2012-07-08T13:18:07 supybot Shutdown initiated.
INFO 2012-07-08T13:18:07 supybot Killing Driver objects.
INFO 2012-07-08T13:18:07 supybot Killing Irc objects.
INFO 2012-07-08T13:18:07 supybot Shutdown complete.

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
"=============================================================================
" File: sonictemplate.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 08-Nov-2011.
" Version: 0.08
" WebPage: http://github.com/mattn/sonictemplate-vim
" Description: Easy and high speed coding method
" Usage:
"
" :Template {name}
" Load template named as {name} in the current buffer.
"
" Or type <c-y> + t
if &cp || (exists('g:loaded_sonictemplate_vim') && g:loaded_sonictemplate_vim)
finish
endif
let g:loaded_sonictemplate_vim = 1
let s:save_cpo = &cpo
set cpo&vim
command! -nargs=1 -complete=customlist,sonictemplate#complete Template call sonictemplate#apply(<f-args>, 'n')
nnoremap <plug>(sonictemplate) :call sonictemplate#select('n')<cr>
inoremap <plug>(sonictemplate) <space><bs><c-o>:call sonictemplate#select('i')<cr>
nmap <unique> <c-y>t <plug>(sonictemplate)
imap <unique> <c-y>t <plug>(sonictemplate)
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et:

View File

@ -1,88 +0,0 @@
let s:tree_up_dir_line = '.. (up a dir)'
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
"how things should be highlighted
syn match NERDTreeFlag #\~#
syn match NERDTreeFlag #\[RO\]#
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for readonly files
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
"highlighting for sym links
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/#
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeFile Normal
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeClosable Type
else
hi def link NERDTreePart Normal
hi def link NERDTreePartFile Normal
hi def link NERDTreeFile Normal
hi def link NERDTreeClosable Title
endif
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
hi def link NERDTreeBookmarkName Identifier
hi def link NERDTreeBookmark normal
hi def link NERDTreeHelp String
hi def link NERDTreeHelpKey Identifier
hi def link NERDTreeHelpCommand Identifier
hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeCWD Statement
hi def link NERDTreeLink Macro
hi def link NERDTreeOpenable Title
hi def link NERDTreeFlag ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement
hi def link NERDTreeCurrentNode Search

View File

@ -1,7 +0,0 @@
#include <stdio.h>
int
main(int argc, char* argv[]) {
{{_cursor_}}
return 0;
}

View File

@ -1,3 +0,0 @@
/**
* {{_cursor_}}
*/

View File

@ -1,3 +0,0 @@
for (int n = 0; n < {{_input_:count}}; n++) {
{{_cursor_}}
}

View File

@ -1,9 +0,0 @@
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
int
main(int argc, char* argv[]) {
{{_cursor_}}
return 0;
}

View File

@ -1,8 +0,0 @@
#include <iostream>
#include <string>
int
main(int argc, char* argv[]) {
{{_cursor_}}
return 0;
}

View File

@ -1,3 +0,0 @@
BOOST_FOREACH(auto x, {{_input_:variable}}) {
{{_cursor_}}
}

View File

@ -1,3 +0,0 @@
/**
* {{_cursor_}}
*/

View File

@ -1 +0,0 @@
std::cout << {{_input_:string}} << std::endl;

View File

@ -1,3 +0,0 @@
for (int n = 0; n < {{_input_:count}}; n++) {
{{_cursor_}}
}

View File

@ -1,5 +0,0 @@
package main
func main() {
{{_cursor_}}
}

View File

@ -1,3 +0,0 @@
package {{_name_}}
{{_cursor_}}

View File

@ -1,3 +0,0 @@
go func() {
{{_cursor_}}
}()

View File

@ -1,5 +0,0 @@
defer func() {
if recover() != nil {
{{_cursor_}}
}
}()

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{_cursor_}}</title>
</head>
<body>
</body>
</html>

View File

@ -1,11 +0,0 @@
/**
* {{_name_}}
*/
public class {{_name_}} {
/**
* Constructor
*/
public {{_name_}}() {
{{_cursor_}}
}
}

View File

@ -1,8 +0,0 @@
/**
* {{_name_}}
*/
public class {{_name_}} {
public static void main(String[] args) {
{{_cursor_}}
}
}

View File

@ -1,15 +0,0 @@
/**
* get {{_input_:name}}
* @return {{_input_:name}}
*/
public {{_input_:type}} get{{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}() {
return {{_input_:name}};
}
/**
* set {{_input_:name}}
* @param {{_input_:name}}
*/
public void set{{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}({{_input_:type}} {{_input_:name}}) {
this.{{_input_:name}} = {{_input_:name}};
}

View File

@ -1,7 +0,0 @@
/**
* get {{_input_:name}}
* @return {{_input_:name}}
*/
public {{_input_:type}} get{{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}() {
return {{_input_:name}};
}

View File

@ -1,3 +0,0 @@
public static void main(String[] args) {
{{_cursor_}}
}

View File

@ -1,6 +0,0 @@
try {
{{_cursor_}}
} catch (Throwable e) {
e.printStackTrace();
} finally {
}

View File

@ -1,3 +0,0 @@
(function() {
{{_cursor_}}
})();

View File

@ -1,3 +0,0 @@
$(function() {
{{_cursor_}}
});

View File

@ -1,3 +0,0 @@
(function() {
{{_cursor_}}
})

View File

@ -1,3 +0,0 @@
$.each({{_input_:variable}}, function() {
{{_cursor_}}
});

View File

@ -1,3 +0,0 @@
$.getJSON("{{_input_:URL}}", function(data) {
{{_cursor_}}
});

View File

@ -1,5 +0,0 @@
$.getJSON("http://query.yahooapis.com/v1/public/yql?callback=?", {
q: "{{_cursor_}}",
format: "json"
}, function (data) {
});

View File

@ -1,19 +0,0 @@
{{_expr_:expand("%:p:h:t")}}
{{_expr_:repeat("=", len(expand("%:p:h:t")))}}
Usage:
------
{{_cursor_}}
Requirements:
-------------
Install:
--------
License:
--------
Author:
-------

View File

@ -1,9 +0,0 @@
package {{_expr_:substitute(substitute(substitute(expand('%'), '.*lib[\\/]', '', 'g'), '[\\/]', '::', 'g'), '\.pm$', '', 'g')}};
use strict;
use warnings;
use utf8;
{{_cursor_}}
1

View File

@ -1,5 +0,0 @@
use strict;
use warnings;
use utf8;
{{_cursor_}}

View File

@ -1,6 +0,0 @@
use strict;
use warnings;
use utf8;
use Test::More;
{{_cursor_}}

View File

@ -1,2 +0,0 @@
my $dbh = DBI->connect("dbi:mysql:{{_cursor_}}", "", "");
$dbh->disconnect;

View File

@ -1,2 +0,0 @@
my $dbh = DBI->connect("dbi:Oracle:{{_cursor_}}", "", "");
$dbh->disconnect;

View File

@ -1,2 +0,0 @@
my $dbh = DBI->connect("dbi:SQLite:dbname={{_cursor_}}");
$dbh->disconnect;

View File

@ -1,5 +0,0 @@
my $sth = $dbh->prepare("{{_cursor_}}");
$sth->execute;
while (my @row = $sth->fetchrow_array) {
#print join(', ', @row), "\n";
}

View File

@ -1,2 +0,0 @@
open my $fh, '<', '{{_cursor_}}' or die "failed to open: $!";
my $content = do { local $/; <$fh> };

View File

@ -1,5 +0,0 @@
my $growl = Growl::Any->new(
appname => '{{_cursor_}}',
events => ['Error']
);
#$growl->notify('Error', 'Failed to do it!');

View File

@ -1,3 +0,0 @@
my $ua = LWP::UserAgent->new;
$ua->env_proxy;
my $res = $ua->get("{{_cursor_}}");

View File

@ -1,7 +0,0 @@
use Config::Pit;
my $config = pit_get("{{_input_:domain}}", require => {
"username" => "username of {{_input_:domain}}",
"password" => "password of {{_input_:domain}}",
});
{{_cursor_}}

View File

@ -1,5 +0,0 @@
sub {{_input_:function name}} {
my ($self{{_input_:arguments}}) = @_;
{{_cursor_}}
}

View File

@ -1,10 +0,0 @@
my $scraper = scraper {
process '{{_cursor_}}', 'data' => 'TEXT';
result 'data';
};
$scraper->user_agent->env_proxy;
#use YAML::Syck;
#for (@{$scraper->scrape( URI->new('') )}) {
# print $_->{data}, "\n";
#}

View File

@ -1,50 +0,0 @@
#######################################
# Program Name #
# #
# Program Purpose #
#######################################
#######################
# BEGIN LICENCE BLOCK #
#######################
# Copyright (c) 2012, Caffeine Linux
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Caffeine Linux nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#####################
# END LICENCE BLOCK #
#####################
{{_cursor_}}
# vim: set ts=4 sw=4 tw=0 et:

View File

@ -1,8 +0,0 @@
# vim: fileencoding=utf-8
def main():
{{_cursor_}}
if __name__ == '__main__':
main()

View File

@ -1,7 +0,0 @@
require "pit"
config = Pit.get("{{_input_:domain}}", :require => {
"username" => "username of {{_input_:domain}}",
"password" => "password of {{_input_:domain}}",
})
{{_cursor_}}

4
.vimrc
View File

@ -37,7 +37,3 @@ if has("autocmd")
autocmd BufNewFile,BufRead *.rss setfiletype xml
endif
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
# Environment setup redone in bash, because using call in Python is lame
# Basic requirements - bash, sudo (Also make sure your user has sudo privileges!)
# Basic requirements - bash, git
# a die function as always
die() {
@ -11,37 +10,13 @@ die() {
# Some variable(s)
userdistro="NULL"
repo="git://github.com/staticsafe/dotfiles.git"
portpath="/opt/local/bin/port" # This is the default install directory for the MacPorts port binary, you may find this useful.
# Lets get this party on the road, shall we?
sudocheck() {
hash sudo &>/dev/null || die 'sudo does not exist, exiting'
printf '%s\n' "sudo check : PASSED"
}
distrocheck() {
hash apt-get &>/dev/null && userdistro="Debian" # For Debian based distros.
hash yum &>/dev/null && userdistro="Fedora" # For RHEL/CentOS/Fedora
hash pacman &>/dev/null && userdistro="Arch" # For Arch Linux
hash pkg_add &>/dev/null && userdistro="FreeBSD" # For FreeBSD
}
installpackages() {
if [[ "$userdistro" == "Debian" ]]; then
sudo apt-get install --assume-yes vim zsh tmux git subversion mercurial most python-pip
elif [[ "$userdistro" == "Fedora" ]]; then
sudo yum install -y vim zsh tmux git subversion mercurial most python-pip
elif [[ "$userdistro" == "Arch" ]]; then
sudo pacman --noconfirm -S vim zsh tmux git mercurial subversion most python-pip
elif [[ "$userdistro" == "FreeBSD" && $(uname -s) == "FreeBSD" ]]; then
sudo pkg_add -r vim zsh tmux git subversion mercurial most py27-pip
else
printf '%s\n' "Your distro's package manager is not supported in this script, continuing with changing shell & linking dotfiles."
fi
gitcheck() {
hash git &>/dev/null || die 'git does not exist, exiting'
printf '%s\n' "git check : PASSED"
}
changeshell() {
@ -56,32 +31,28 @@ changeshell() {
linkfiles() {
#find ~/dev/dotfiles -type f -name ".*" -execdir ln -s -f {}
# --target-directory=$HOME \; # removed until I can figure out the issue
ln -sf ~/dev/dotfiles/.zshrc $HOME/
ln -sf ~/dev/dotfiles/.vimrc $HOME/
ln -sf ~/dev/dotfiles/.tmux.conf $HOME/
ln -sf ~/dev/dotfiles/.conkyrc $HOME/
ln -sf ~/dev/dotfiles/.zsh $HOME/
ln -sf ~/dev/dotfiles/.vim $HOME/
ln -sf ~/dotfiles/.zshrc $HOME/
ln -sf ~/dotfiles/.vimrc $HOME/
ln -sf ~/dotfiles/.tmux.conf $HOME/
ln -sf ~/dotfiles/.conkyrc $HOME/
ln -sf ~/dotfiles/.zsh $HOME/
ln -sf ~/dotfiles/.vim $HOME/
touch ~/.zhistory
}
getdotfiles() {
if [[ -d ~/dev/dotfiles ]]; then
cd ~/dev/dotfiles
if [[ -d ~/dotfiles ]]; then
cd ~/dotfiles
git pull
linkfiles
else
mkdir ~/dev
cd ~/dev
cd
git clone $repo
linkfiles
fi
}
sudocheck
distrocheck
installpackages
gitcheck
changeshell
getdotfiles
exec zsh

View File

@ -1,171 +0,0 @@
#!/usr/bin/env python
#Script has been deprecated.
#Personal environment setup script
#Dependencies - Supported distros, sudo, python2
import os
from subprocess import call
import platform
import urllib2
import tarfile
#global vars
vimrcurl = "https://raw.github.com/staticsafe/dotfiles/master/.vimrc"
zshrcurl = "https://raw.github.com/staticsafe/dotfiles/master/.zshrc"
tmuxurl = "https://raw.github.com/staticsafe/dotfiles/master/.tmux.conf"
vimdirurl = "http://dl.dropbox.com/u/2888062/vimdir.tar.bz2"
conkyrc = "https://raw.github.com/staticsafe/dotfiles/master/.conkyrc"
envupdate = "https://raw.github.com/staticsafe/dotfiles/master/envupdate.sh"
def sudocheck():
#sudocheck
sudopath = "/usr/bin/sudo"
if os.path.isfile(sudopath) == False:
print 'This script needs sudo to run!'
raise SystemExit
else:
print 'Sudo check: PASSED!'
def macportscheck():
# This function checks if MacPorts exists on a OSX machine or not
portspath = "/opt/local/bin/port"
if os.path.isfile(portspath) == False:
print "We need MacPorts to run this script for you! Get it from here - http://www.macports.org/"
raise SystemExit
else:
print "MacPorts check: PASSED!"
def urldownload(confurl = ""):
#Thanks PabloG from StackOverflow for this little snippet - http://stackoverflow.com/a/22776
url = confurl
file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)
file_size_dl = 0
block_sz = 8192
while True:
buffer = u.read(block_sz)
if not buffer:
break
file_size_dl += len(buffer)
f.write(buffer)
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
status = status + chr(8)*(len(status)+1)
print status,
f.close()
def checksandactions():
#vars for various conf files and dirs
vimrcdir = os.path.join(os.environ['HOME'], ".vimrc")
zshrcdir = os.path.join(os.environ['HOME'], ".zshrc")
tmuxconfdir = os.path.join(os.environ['HOME'], ".tmux.conf")
vimdir = os.path.join(os.environ['HOME'], ".vim")
conkydir = os.path.join(os.environ['HOME'], ".conkyrc")
usershell = os.getenv('SHELL')
#checks to prevent clobbering
if os.path.isfile(vimrcdir) == True:
print ".vimrc already exists, skipping download!"
else:
urldownload(confurl = vimrcurl)
if os.path.isfile(zshrcdir) == True:
print ".zshrc already exists, skipping download!"
else:
urldownload(confurl = zshrcurl)
if os.path.isfile(tmuxconfdir) == True:
print ".tmux.conf already exists, skipping download!"
else:
urldownload(confurl = tmuxurl)
if os.path.isdir(vimdir) == True:
print ".vim dir already exists, skipping download!"
else:
urldownload(confurl = vimdirurl)
tar = tarfile.open("vimdir.tar.bz2")
tar.extractall()
tar.close()
if os.path.isfile(conkydir) == True:
print ".conkyrc already exists, skipping download!"
else:
urldownload(confurl = conkyrc)
if usershell == "/bin/zsh":
print "Your default shell is already zsh! Skipping."
else:
print "Setting default shell for this user to zsh! Log out and log back in to see changes."
setzsh = call("chsh -s $(which zsh)", shell = True)
zshhistory = call("touch ~/.zhistory", shell = True)
def envArch():
sudocheck()
#Install relevant packages
installpackages = call("sudo pacman --noconfirm -S vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles
checksandactions()
def envFedora():
sudocheck()
#Install relevant packages
installpackages = call ("sudo yum install -y vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles
checksandactions()
def envDebian():
sudocheck()
#Install relevant packages
installpackages = call ("sudo apt-get install --assume-yes vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles
checksandactions()
def envOSX():
sudocheck()
macportscheck()
#Install relevant packages
installpackages = call ("sudo /opt/local/bin/port install vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles
checksandactions()
def main():
#homedircheck
homedir = os.environ['HOME']
currentdir = os.getcwd()
if currentdir != homedir:
print "Changing cwd to homedir!"
os.chdir(homedir)
else:
print "Home directory check : PASSED!"
#distrocheck
userdistro = platform.linux_distribution()
osxcheck = platform.uname() # linux_distribution is useless on OSX so we use this
if userdistro[0] == "Fedora":
envFedora()
elif userdistro[0] == "debian":
envDebian()
elif userdistro[0] == "Arch" or os.path.isfile("/etc/arch-release") == True:
envArch()
elif userdistro[0] == "Ubuntu":
envDebian()
elif osxcheck[0] == "Darwin":
envOSX()
else:
print "This script is not supported for your distro, exiting."
raise SystemExit
if __name__ == "__main__":
main()

12
worktools.txt Normal file
View File

@ -0,0 +1,12 @@
List of tools needed for my environment, dev or otherwise (in no particular
order):
- zsh/bash ($SHELL)
- vim ($EDITOR)
- most ($PAGER)
- git/svn
- tmux
- multitail
- weechat
- mutt
- mtr
- ansible