Merge branch 'master' into mMontu-master
This commit is contained in:
commit
2cdaac1b1c
@ -111,6 +111,12 @@ else {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if (${1:/* condition */}) {
|
||||
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if (${1:/* condition */})
|
||||
{
|
||||
|
@ -140,13 +140,13 @@ endsnippet
|
||||
snippet ffe "form_for with errors"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
@ -32,15 +32,15 @@ ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet for "for (...) {...} (faster)"
|
||||
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--) {
|
||||
${3:$1[$2]}${VISUAL}$0
|
||||
snippet for "for (...) {...} (counting up)" b
|
||||
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for (...) {...}"
|
||||
for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) {
|
||||
${3:$1[$2]}${VISUAL}$0
|
||||
snippet ford "for (...) {...} (counting down, faster)" b
|
||||
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -79,42 +79,74 @@ endsnippet
|
||||
|
||||
# Snippets for Console Debug Output
|
||||
|
||||
snippet cl "console.log"
|
||||
console.log(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cw "console.warn"
|
||||
console.warn(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet ce "console.error"
|
||||
console.error(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet ca "console.assert"
|
||||
snippet ca "console.assert" b
|
||||
console.assert(${1:assertion}, ${2:"${3:message}"});
|
||||
endsnippet
|
||||
|
||||
snippet cgroup "console.group"
|
||||
snippet cclear "console.clear" b
|
||||
console.clear();
|
||||
endsnippet
|
||||
|
||||
snippet cdir "console.dir" b
|
||||
console.dir(${1:object});
|
||||
endsnippet
|
||||
|
||||
snippet cdirx "console.dirxml" b
|
||||
console.dirxml(${1:object});
|
||||
endsnippet
|
||||
|
||||
snippet ce "console.error" b
|
||||
console.error(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cgroup "console.group" b
|
||||
console.group("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ctime "console.time"
|
||||
snippet cgroupc "console.groupCollapsed" b
|
||||
console.groupCollapsed("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ci "console.info" b
|
||||
console.info(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cl "console.log" b
|
||||
console.log(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cprof "console.profile" b
|
||||
console.profile("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.profileEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ctable "console.table" b
|
||||
console.table(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet ctime "console.time" b
|
||||
console.time("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.timeEnd("$1");
|
||||
endsnippet
|
||||
|
||||
snippet ctimestamp "console.timestamp"
|
||||
console.timeStamp("${1:label}")
|
||||
snippet ctimestamp "console.timeStamp" b
|
||||
console.timeStamp("${1:label}");
|
||||
endsnippet
|
||||
|
||||
snippet ctrace "console.trace"
|
||||
snippet ctrace "console.trace" b
|
||||
console.trace();
|
||||
endsnippet
|
||||
|
||||
snippet cw "console.warn" b
|
||||
console.warn(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
# AMD (Asynchronous Module Definition) snippets
|
||||
|
||||
snippet def "define an AMD module"
|
||||
|
49
UltiSnips/javascript_jsdoc.snippets
Normal file
49
UltiSnips/javascript_jsdoc.snippets
Normal file
@ -0,0 +1,49 @@
|
||||
# JSDoc snippets
|
||||
|
||||
snippet /* "A JSDoc comment" b
|
||||
/**
|
||||
* ${1:${VISUAL}}$0
|
||||
*/
|
||||
endsnippet
|
||||
|
||||
snippet @au "@author email (First Last)"
|
||||
@author ${1:`!v g:snips_author_email`} (${2:`!v g:snips_author`})
|
||||
endsnippet
|
||||
|
||||
snippet @li "@license Description"
|
||||
@license ${1:MIT}$0
|
||||
endsnippet
|
||||
|
||||
snippet @ver "@version Semantic version"
|
||||
@version ${1:0.1.0}$0
|
||||
endsnippet
|
||||
|
||||
snippet @fileo "@fileoverview Description" b
|
||||
/**
|
||||
* @fileoverview ${1:${VISUAL:A description of the file}}$0
|
||||
*/
|
||||
endsnippet
|
||||
|
||||
snippet @constr "@constructor"
|
||||
@constructor
|
||||
endsnippet
|
||||
|
||||
snippet @p "@param {Type} varname Description"
|
||||
@param {${1:Type}} ${2:varname} ${3:Description}
|
||||
endsnippet
|
||||
|
||||
snippet @ret "@return {Type} Description"
|
||||
@return {${1:Type}} ${2:Description}
|
||||
endsnippet
|
||||
|
||||
snippet @pri "@private"
|
||||
@private
|
||||
endsnippet
|
||||
|
||||
snippet @over "@override"
|
||||
@override
|
||||
endsnippet
|
||||
|
||||
snippet @pro "@protected"
|
||||
@protected
|
||||
endsnippet
|
@ -232,7 +232,8 @@ snippet construct "__construct()" b
|
||||
/**
|
||||
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
||||
*/
|
||||
public function __construct(${1:$dependencies}) {${1/\$(\w+)(, )*/\n\t$this->$1 = $$1;/g}
|
||||
public function __construct(${1:$dependencies})
|
||||
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
53
UltiSnips/scss.snippets
Normal file
53
UltiSnips/scss.snippets
Normal file
@ -0,0 +1,53 @@
|
||||
snippet /@?imp/ "@import '...';" br
|
||||
@import '${1:file}';
|
||||
endsnippet
|
||||
|
||||
snippet /@?inc/ "@include mixin(...);" br
|
||||
@include ${1:mixin}(${2:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet /@?ext?/ "@extend %placeholder;" br
|
||||
@extend %${1:placeholder};
|
||||
endsnippet
|
||||
|
||||
snippet /@?mixin/ "@mixin (...) { ... }" br
|
||||
@mixin ${1:name}(${2:arguments}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /@?fun/ "@function (...) { ... }" br
|
||||
@function ${1:name}(${2:arguments}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /@?if/ "@if (...) { ... }" br
|
||||
@if ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /(} )?@?else/ "@else { ... }" br
|
||||
@else ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /@?for/ "@for loop" br
|
||||
@for ${1:$i} from ${2:1} through ${3:3} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /@?each/ "@each loop" br
|
||||
@each ${1:$item} in ${2:item, item, item} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /@?while/ "@while loop" br
|
||||
@while ${1:$i} ${2:>} ${3:0} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
@ -1,39 +1,26 @@
|
||||
extends texmath
|
||||
|
||||
###########################################################################
|
||||
# LATEX SNIPPETS #
|
||||
###########################################################################
|
||||
|
||||
snippet r "\\ref{}" w
|
||||
\ref{$1}
|
||||
endsnippet
|
||||
|
||||
###########################################################################
|
||||
# TEXTMATE SNIPPETS #
|
||||
###########################################################################
|
||||
|
||||
#################
|
||||
# GENERAL STUFF #
|
||||
#################
|
||||
snippet "b(egin)?" "begin{} / end{}" br
|
||||
\begin{${1:something}}
|
||||
${0:${VISUAL}}
|
||||
\end{$1}
|
||||
endsnippet
|
||||
|
||||
####################
|
||||
# TABULARS, ARRAYS #
|
||||
####################
|
||||
|
||||
snippet tab
|
||||
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
|
||||
$0${2/((?<=.)c|l|r)|./(?1: & )/g}
|
||||
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
endsnippet
|
||||
|
||||
########################
|
||||
# ENUM, DESCR, ITEMIZE #
|
||||
########################
|
||||
snippet fig "Figure environment" b
|
||||
\begin{figure}${2:[htpb]}
|
||||
\centering
|
||||
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
|
||||
\caption{${4/(\w+)\.\w+/\u$1/}$0}
|
||||
\label{fig:${4/(\w+)\.\w+/$1/}}
|
||||
\end{figure}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumerate" b
|
||||
\begin{enumerate}
|
||||
\item $0
|
||||
@ -52,17 +39,16 @@ snippet desc "Description" b
|
||||
\end{description}
|
||||
endsnippet
|
||||
|
||||
#####################################
|
||||
# SECTIONS, CHAPTERS AND THEIR LIKE #
|
||||
#####################################
|
||||
snippet it "Individual item" b
|
||||
\item ${1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet part "Part" b
|
||||
\part{${1:part name}}
|
||||
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% part $2 (end)
|
||||
endsnippet
|
||||
|
||||
snippet cha "Chapter" b
|
||||
@ -70,8 +56,6 @@ snippet cha "Chapter" b
|
||||
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% chapter $2 (end)
|
||||
endsnippet
|
||||
|
||||
snippet sec "Section" b
|
||||
@ -79,18 +63,13 @@ snippet sec "Section" b
|
||||
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% section $2 (end)
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet sub "Subsection" b
|
||||
\subsection{${1:subsection name}}
|
||||
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% subsection $2 (end)
|
||||
endsnippet
|
||||
|
||||
snippet ssub "Subsubsection" b
|
||||
@ -98,9 +77,6 @@ snippet ssub "Subsubsection" b
|
||||
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% subsubsection $2 (end)
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph" b
|
||||
@ -108,29 +84,24 @@ snippet par "Paragraph" b
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% paragraph $2 (end)
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet subp "Subparagraph" b
|
||||
\subparagraph{${1:subparagraph name}}
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
|
||||
% subparagraph $2 (end)
|
||||
endsnippet
|
||||
|
||||
###############
|
||||
# Utilities #
|
||||
###############
|
||||
snippet ni "Non-indented paragraph" b
|
||||
\noindent
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet pac "Package" b
|
||||
\usepackage[${1:options}]{${2:package}}$0
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet lp "Long parenthesis"
|
||||
\left(${1:${VISUAL:contents}}\right)$0
|
||||
endsnippet
|
||||
|
@ -1402,6 +1402,7 @@ Contributors listed in chronological order:
|
||||
Romain Giot - rgiot
|
||||
Sergey Alexandrov - taketwo
|
||||
Brian Mock - saikobee
|
||||
Gernot Höflechner - LFDM
|
||||
|
||||
|
||||
8.2 Snippets *UltiSnips-contrisnippets*
|
||||
@ -1455,6 +1456,7 @@ Contributors listed in chronological order:
|
||||
Bernhard Vallant (lazerscience)
|
||||
Von Welch (von)
|
||||
Nikola Petrov (nikolavp)
|
||||
Maarten Slagter (slagtermaarten)
|
||||
|
||||
Thank you for your support.
|
||||
|
||||
|
@ -254,6 +254,11 @@ endf
|
||||
function! UltiSnips_LeavingBuffer()
|
||||
exec g:_uspy "UltiSnips_Manager.leaving_buffer()"
|
||||
endf
|
||||
|
||||
function! UltiSnips_LeavingInsertMode()
|
||||
exec g:_uspy "UltiSnips_Manager.restore_unnamed_register()"
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
" COMPLETE FUNCTIONS {{{
|
||||
function! UltiSnipsFiletypeComplete(arglead, cmdline, cursorpos)
|
||||
@ -289,6 +294,7 @@ exec g:_uspy "UltiSnips_Manager.backward_trigger = vim.eval('g:UltiSnipsJumpBack
|
||||
au CursorMovedI * call UltiSnips_CursorMoved()
|
||||
au CursorMoved * call UltiSnips_CursorMoved()
|
||||
au BufLeave * call UltiSnips_LeavingBuffer()
|
||||
au InsertLeave * call UltiSnips_LeavingInsertMode()
|
||||
|
||||
call UltiSnips_MapKeys()
|
||||
|
||||
|
@ -22,7 +22,7 @@ def _plugin_dir():
|
||||
be updated if the code moves.
|
||||
"""
|
||||
d = __file__
|
||||
for i in xrange(10):
|
||||
for i in range(10):
|
||||
d = os.path.dirname(d)
|
||||
if os.path.isdir(os.path.join(d, "plugin")) and os.path.isdir(os.path.join(d, "doc")):
|
||||
return d
|
||||
@ -32,18 +32,19 @@ def _snippets_dir_is_before_plugin_dir():
|
||||
""" Returns True if the snippets directory comes before the plugin
|
||||
directory in Vim's runtime path. False otherwise.
|
||||
"""
|
||||
paths = [ os.path.expanduser(p).rstrip(os.path.sep)
|
||||
paths = [ os.path.realpath(os.path.expanduser(p)).rstrip(os.path.sep)
|
||||
for p in _vim.eval("&runtimepath").split(',') ]
|
||||
home = _vim.eval("$HOME")
|
||||
def vim_path_index(suffix):
|
||||
path = os.path.join(home, suffix).rstrip(os.path.sep)
|
||||
path = os.path.realpath(os.path.join(home, suffix)).rstrip(os.path.sep)
|
||||
try:
|
||||
return paths.index(path)
|
||||
except ValueError:
|
||||
return -1
|
||||
try:
|
||||
real_vim_path_index = max(vim_path_index(".vim"), vim_path_index("vimfiles"))
|
||||
return paths.index(_plugin_dir()) < real_vim_path_index
|
||||
plugin_path_index = paths.index(_plugin_dir())
|
||||
return plugin_path_index < real_vim_path_index
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
@ -552,8 +553,13 @@ class SnippetManager(object):
|
||||
self._supertab_keys = None
|
||||
self._csnippets = []
|
||||
|
||||
# needed to retain the unnamed register at all times
|
||||
self._unnamed_reg_cached = False
|
||||
self._last_placeholder = None
|
||||
|
||||
self.reset()
|
||||
|
||||
|
||||
@err_to_scratch_buffer
|
||||
def reset(self, test_error=False):
|
||||
self._vstate = VimState()
|
||||
@ -833,10 +839,24 @@ class SnippetManager(object):
|
||||
self._current_snippet_is_done()
|
||||
jumped = self._jump(backwards)
|
||||
if jumped:
|
||||
self._cache_unnamed_register()
|
||||
self._vstate.remember_position()
|
||||
self._ignore_movements = True
|
||||
return jumped
|
||||
|
||||
def _cache_unnamed_register(self):
|
||||
self._unnamed_reg_cached = True
|
||||
unnamed_reg = _vim.eval('@"')
|
||||
if self._last_placeholder != unnamed_reg:
|
||||
self._unnamed_reg_cache = unnamed_reg
|
||||
self._last_placeholder = self._ctab._initial_text
|
||||
|
||||
def restore_unnamed_register(self):
|
||||
if self._unnamed_reg_cached:
|
||||
escaped_cache = self._unnamed_reg_cache.replace("'", "''")
|
||||
_vim.command("let @\"='%s'" % escaped_cache)
|
||||
self._unnamed_register_cached = False
|
||||
|
||||
def _handle_failure(self, trigger):
|
||||
"""
|
||||
Mainly make sure that we play well with SuperTab
|
||||
|
7
test.py
7
test.py
@ -3041,6 +3041,13 @@ class Bug1251994(_VimTest):
|
||||
wanted = " world hello;blub"
|
||||
# End: 1251994 #}}}
|
||||
|
||||
# Test for Github Pull Request #134 {{{#
|
||||
class RetainsTheUnnamedRegister(_VimTest):
|
||||
snippets = ("test", "${1:hello} ${2:world} ${0}")
|
||||
keys = "yank" + ESC + "by4lea test" + EX + "HELLO" + JF + JF + ESC + "p"
|
||||
wanted = "yank HELLO world yank"
|
||||
# End: Github Pull Request # 134 #}}}
|
||||
|
||||
class VerifyVimDict1(_VimTest):
|
||||
"""check:
|
||||
correct type (4 means vim dictionary)
|
||||
|
Loading…
Reference in New Issue
Block a user