add ultisnips plugin
add snippets in UltiSnips add python modules in pythonx/ultisnips
This commit is contained in:
parent
bacdf552fb
commit
d6fcdb2060
0
UltiSnips/all.snippets
Normal file
0
UltiSnips/all.snippets
Normal file
39
UltiSnips/c.snippets
Normal file
39
UltiSnips/c.snippets
Normal file
@ -0,0 +1,39 @@
|
||||
global !p
|
||||
from ultisnips.all import *
|
||||
from ultisnips.c import *
|
||||
endglobal
|
||||
|
||||
|
||||
snippet fun "C function" b
|
||||
${1:int} ${2:main}(${3:void})
|
||||
{
|
||||
${0}
|
||||
`!p snip.rv = returnval(t[1])`
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet todo "TODO comment" b
|
||||
/* TODO(`!p snip.rv = getUsername("valeth", True)`@`!v strftime("%d.%m.%y")`): ${1:Description} */
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet doxfun "Doxygen function documentation" b
|
||||
/**
|
||||
* ${1:DESCRIPTION}
|
||||
* @brief ${2:BRIEF}
|
||||
* @param ${3:PARAM}
|
||||
* @return ${4:RETURN}
|
||||
*/
|
||||
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet doxhead "Doxygen documentation file header" b
|
||||
/**
|
||||
* @author ${1:`!p snip.rv = getUsername("valeth", True)`}
|
||||
* @date ${2:`!v strftime("%d.%m.%Y")`}
|
||||
* @file ${3:`!v expand("%:t")`}
|
||||
*/
|
||||
endsnippet
|
||||
|
11
UltiSnips/haskell.snippets
Normal file
11
UltiSnips/haskell.snippets
Normal file
@ -0,0 +1,11 @@
|
||||
snippet mod "Create new module" b
|
||||
module ${1:`!v expand("%:p:h:t")`} (
|
||||
) where
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet hdfun "Haddock function documentation" b
|
||||
-- | ${1:DESCRIPTION}
|
||||
-- ${2}
|
||||
endsnippet
|
||||
|
12
UltiSnips/sh.snippets
Normal file
12
UltiSnips/sh.snippets
Normal file
@ -0,0 +1,12 @@
|
||||
snippet bang "Shebang line for shellscripts" b
|
||||
#!/usr/bin/env bash
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet fun "Shell function" b
|
||||
function $1
|
||||
{
|
||||
|
||||
}
|
||||
endsnippet
|
||||
|
1
plugins/ultisnips.vim
Normal file
1
plugins/ultisnips.vim
Normal file
@ -0,0 +1 @@
|
||||
Plug 'SirVer/ultisnips'
|
1
plugins/vim-snippets.vim
Normal file
1
plugins/vim-snippets.vim
Normal file
@ -0,0 +1 @@
|
||||
Plug 'honza/vim-snippets'
|
10
pythonx/ultisnips/all.py
Normal file
10
pythonx/ultisnips/all.py
Normal file
@ -0,0 +1,10 @@
|
||||
def getUsername(username, gecos = True, passwd = "/etc/passwd"):
|
||||
content = [x.split(":") for x in open(passwd, "r").readlines()]
|
||||
|
||||
for entry in content:
|
||||
if len(entry) != 0 and entry[0] == username:
|
||||
if gecos and len(entry[4]) != 0:
|
||||
return entry[4]
|
||||
else:
|
||||
return username
|
||||
|
16
pythonx/ultisnips/c.py
Normal file
16
pythonx/ultisnips/c.py
Normal file
@ -0,0 +1,16 @@
|
||||
def returnval(t):
|
||||
if t == "void":
|
||||
return ""
|
||||
|
||||
ret = {
|
||||
"int": "0",
|
||||
"float": "0.0",
|
||||
"double": "0.0",
|
||||
"bool": "false"
|
||||
}
|
||||
|
||||
if t in ret.keys():
|
||||
return "return " + ret[t] + ";"
|
||||
else:
|
||||
return "return NULL;"
|
||||
|
Loading…
Reference in New Issue
Block a user