1
0
Fork 0
mirror of synced 2024-06-01 15:01:10 -04:00

Merge branch 'master' of github.com:schmas/vimrc

* 'master' of github.com:schmas/vimrc:
  issue #60
This commit is contained in:
Diego Schmidt 2014-08-06 23:27:01 -03:00
commit 37e6392a4c
2 changed files with 448 additions and 448 deletions

View file

@ -1,120 +1,120 @@
*indent-object.txt* Text objects based on indent levels. *indent-object.txt* Text objects based on indent levels.
Copyright (c) 2010 Michael Smith Copyright (c) 2010 Michael Smith
Indent Text Objects Indent Text Objects
INTRODUCTION |idntobj-introduction| INTRODUCTION |idntobj-introduction|
TEXT OBJECTS |idntobj-objects| TEXT OBJECTS |idntobj-objects|
BLANK LINES |idntobj-blanklines| BLANK LINES |idntobj-blanklines|
ABOUT |idntobj-about| ABOUT |idntobj-about|
============================================================================== ==============================================================================
INTRODUCTION *idntobj-introduction* INTRODUCTION *idntobj-introduction*
Vim text objects provide a convenient way to select and operate on various Vim text objects provide a convenient way to select and operate on various
types of objects. These objects include regions surrounded by various types of types of objects. These objects include regions surrounded by various types of
brackets and various parts of language (ie sentences, paragraphs, etc). brackets and various parts of language (ie sentences, paragraphs, etc).
This plugin defines a new text object, based on indentation levels. This is This plugin defines a new text object, based on indentation levels. This is
very useful in languages such as Python, in which the syntax defines scope in very useful in languages such as Python, in which the syntax defines scope in
terms of indentation. Using the objects defined in this plugin, an entire if terms of indentation. Using the objects defined in this plugin, an entire if
structure can be quickly selected, for example. structure can be quickly selected, for example.
============================================================================== ==============================================================================
TEXT OBJECTS *ai* *ii* *aI* *iI* *idntobj-objects* TEXT OBJECTS *ai* *ii* *aI* *iI* *idntobj-objects*
This plugin defines two new text objects. These are very similar - they differ This plugin defines two new text objects. These are very similar - they differ
only in whether they include the line below the block or not. only in whether they include the line below the block or not.
Key Mapping Description ~ Key Mapping Description ~
> >
<count>ai (A)n (I)ndentation level and line above. <count>ai (A)n (I)ndentation level and line above.
<count>ii (I)nner (I)ndentation level (no line above). <count>ii (I)nner (I)ndentation level (no line above).
<count>aI (A)n (I)ndentation level and lines above/below. <count>aI (A)n (I)ndentation level and lines above/below.
<count>iI (I)nner (I)ndentation level (no lines above/below). <count>iI (I)nner (I)ndentation level (no lines above/below).
< <
Note that the iI mapping is mostly included simply for completeness, it is Note that the iI mapping is mostly included simply for completeness, it is
effectively a synonym for ii. effectively a synonym for ii.
Just like regular text objects, these mappings can be used either with Just like regular text objects, these mappings can be used either with
operators expecting a motion, such as 'd' or 'c', as well as in visual mode. operators expecting a motion, such as 'd' or 'c', as well as in visual mode.
In visual mode the mapping can be repeated, which has the effect of In visual mode the mapping can be repeated, which has the effect of
iteratively increasing the scope of indentation block selected. Specifying a iteratively increasing the scope of indentation block selected. Specifying a
count can be used to achieve the same effect. count can be used to achieve the same effect.
The difference between |ai| and |aI| is that |ai| includes the line The difference between |ai| and |aI| is that |ai| includes the line
immediately above the indentation block, whereas aI includes not only that, immediately above the indentation block, whereas aI includes not only that,
but also the line below. Which of these is most useful largely depends on the but also the line below. Which of these is most useful largely depends on the
structure of the language being edited. structure of the language being edited.
For example, when editing the Python code, |ai| is generally more useful, as For example, when editing the Python code, |ai| is generally more useful, as
the line above the indentation block is usually related to it. For example, in the line above the indentation block is usually related to it. For example, in
the following code (* is used to indicate the cursor position): the following code (* is used to indicate the cursor position):
> >
if foo > 3: if foo > 3:
log("foo is big") * log("foo is big") *
foo = 3 foo = 3
do_something_else() do_something_else()
< <
the if clause is logically related to the code block, whereas the function the if clause is logically related to the code block, whereas the function
call below is not. It is unlikely we would want to select the line below when call below is not. It is unlikely we would want to select the line below when
we are interested in the if block. we are interested in the if block.
However, in other languages, such as Vim scripts, control structures are However, in other languages, such as Vim scripts, control structures are
usually terminated with something like 'endif'. Therefore, in this example: usually terminated with something like 'endif'. Therefore, in this example:
> >
if foo > 3 if foo > 3
echo "foo is big" * echo "foo is big" *
let foo = 3 let foo = 3
endif endif
call do_something_else() call do_something_else()
< <
we would more likely want to include the endif when we select the if we would more likely want to include the endif when we select the if
structure. structure.
============================================================================== ==============================================================================
BLANK LINES *idntobj-blanklines* BLANK LINES *idntobj-blanklines*
When scanning code blocks, the plugin usually ignores blank lines. There is an When scanning code blocks, the plugin usually ignores blank lines. There is an
exception to this, however, when the block being selected is not indented. In exception to this, however, when the block being selected is not indented. In
this case if blank lines are ignored, then the entire file would be selected. this case if blank lines are ignored, then the entire file would be selected.
Instead when code at the top level is being indented blank lines are Instead when code at the top level is being indented blank lines are
considered to delimit the block. considered to delimit the block.
============================================================================== ==============================================================================
ABOUT *idntobj-about* ABOUT *idntobj-about*
vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The
project repository is kept at: project repository is kept at:
http://github.com/michaeljsmith/vim-indent-object http://github.com/michaeljsmith/vim-indent-object
Any feedback or criticism is welcome, and can be mailed to the author at the Any feedback or criticism is welcome, and can be mailed to the author at the
above email address. Alternatively issues can be raised on the project above email address. Alternatively issues can be raised on the project
website. website.
Licence: Licence:
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE. IN THE SOFTWARE.

View file

@ -1,328 +1,328 @@
####################################################################### #######################################################################
# C# Snippets for UltiSnips # # C# Snippets for UltiSnips #
####################################################################### #######################################################################
priority -50 priority -50
######################### #########################
# classes and structs # # classes and structs #
######################### #########################
snippet namespace "namespace" b snippet namespace "namespace" b
namespace ${1:MyNamespace} namespace ${1:MyNamespace}
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet class "class" w snippet class "class" w
class ${1:MyClass} class ${1:MyClass}
{ {
$0 $0
} }
endsnippet endsnippet
snippet struct "struct" w snippet struct "struct" w
struct ${1:MyStruct} struct ${1:MyStruct}
{ {
$0 $0
} }
endsnippet endsnippet
snippet interface "interface" w snippet interface "interface" w
interface I${1:Interface} interface I${1:Interface}
{ {
$0 $0
} }
endsnippet endsnippet
snippet enum "enumeration" b snippet enum "enumeration" b
enum ${1:MyEnum} { ${2:Item} }; enum ${1:MyEnum} { ${2:Item} };
endsnippet endsnippet
############ ############
# Main() # # Main() #
############ ############
snippet sim "static int main" b snippet sim "static int main" b
static int Main(string[] args) static int Main(string[] args)
{ {
$0 $0
} }
endsnippet endsnippet
snippet svm "static void main" b snippet svm "static void main" b
static void Main(string[] args) static void Main(string[] args)
{ {
$0 $0
} }
endsnippet endsnippet
################ ################
# properties # # properties #
################ ################
snippet prop "Simple property declaration" b snippet prop "Simple property declaration" b
public ${1:int} ${2:MyProperty} { get; set; } public ${1:int} ${2:MyProperty} { get; set; }
endsnippet endsnippet
snippet propfull "Full property declaration" b snippet propfull "Full property declaration" b
private ${1:int} ${2:_myProperty}; private ${1:int} ${2:_myProperty};
public $1 ${3:MyProperty} public $1 ${3:MyProperty}
{ {
get { return $2; } get { return $2; }
set { $2 = value; } set { $2 = value; }
} }
endsnippet endsnippet
snippet propg "Property with a private setter" b snippet propg "Property with a private setter" b
public ${1:int} ${2:MyProperty} { get; private set; } public ${1:int} ${2:MyProperty} { get; private set; }
endsnippet endsnippet
############ ############
# blocks # # blocks #
############ ############
snippet #if "#if #endif" b snippet #if "#if #endif" b
#if ${1:DEBUG} #if ${1:DEBUG}
${VISUAL}$0 ${VISUAL}$0
#endif #endif
endsnippet endsnippet
snippet #region "#region #endregion" b snippet #region "#region #endregion" b
#region ${1:Region} #region ${1:Region}
${VISUAL}$0 ${VISUAL}$0
#endregion #endregion
endsnippet endsnippet
########### ###########
# loops # # loops #
########### ###########
snippet for "for loop" b snippet for "for loop" b
for (int ${1:i} = 0; $1 < ${2:10}; $1++) for (int ${1:i} = 0; $1 < ${2:10}; $1++)
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet forr "for loop (reverse)" b snippet forr "for loop (reverse)" b
for (int ${1:i} = ${2:10}; $1 >= 0; $1--) for (int ${1:i} = ${2:10}; $1 >= 0; $1--)
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet foreach "foreach loop" b snippet foreach "foreach loop" b
foreach (${3:var} ${2:item} in ${1:items}) foreach (${3:var} ${2:item} in ${1:items})
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet while "while loop" b snippet while "while loop" b
while (${1:true}) while (${1:true})
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet do "do loop" b snippet do "do loop" b
do do
{ {
${VISUAL}$0 ${VISUAL}$0
} while (${1:true}); } while (${1:true});
endsnippet endsnippet
############### ###############
# branching # # branching #
############### ###############
snippet if "if statement" b snippet if "if statement" b
if ($1) if ($1)
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet ife "if else statement" b snippet ife "if else statement" b
if ($1) if ($1)
{ {
${VISUAL}$0 ${VISUAL}$0
} }
else else
{ {
} }
endsnippet endsnippet
snippet elif "else if" b snippet elif "else if" b
else if ($1) else if ($1)
{ {
$0 $0
} }
endsnippet endsnippet
snippet elseif "else if" b snippet elseif "else if" b
else if ($1) else if ($1)
{ {
$0 $0
} }
endsnippet endsnippet
snippet ifnn "if not null" b snippet ifnn "if not null" b
if ($1 != null) if ($1 != null)
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet switch "switch statement" b snippet switch "switch statement" b
switch (${1:statement}) switch (${1:statement})
{ {
case ${2:value}: case ${2:value}:
break; break;
default: default:
$0break; $0break;
} }
endsnippet endsnippet
snippet case "case" b snippet case "case" b
case ${1:value}: case ${1:value}:
$2 $2
break; break;
endsnippet endsnippet
############## ##############
# wrappers # # wrappers #
############## ##############
snippet using "using statement" b snippet using "using statement" b
using (${1:resource}) using (${1:resource})
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet unchecked "unchecked block" b snippet unchecked "unchecked block" b
unchecked unchecked
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet checked "checked block" b snippet checked "checked block" b
checked checked
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
snippet unsafe "unsafe" b snippet unsafe "unsafe" b
unsafe unsafe
{ {
${VISUAL}$0 ${VISUAL}$0
} }
endsnippet endsnippet
######################## ########################
# exception handling # # exception handling #
######################## ########################
snippet try "try catch block" b snippet try "try catch block" b
try try
{ {
${VISUAL}$0 ${VISUAL}$0
} }
catch (${1:Exception} ${2:e}) catch (${1:Exception} ${2:e})
{ {
throw; throw;
} }
endsnippet endsnippet
snippet tryf "try finally block" b snippet tryf "try finally block" b
try try
{ {
${VISUAL}$0 ${VISUAL}$0
} }
finally finally
{ {
} }
endsnippet endsnippet
snippet throw "throw" snippet throw "throw"
throw new ${1}Exception("${2}"); throw new ${1}Exception("${2}");
endsnippet endsnippet
########## ##########
# LINQ # # LINQ #
########## ##########
snippet from "LINQ syntax" b snippet from "LINQ syntax" b
var ${1:seq} = var ${1:seq} =
from ${2:item1} in ${3:items1} from ${2:item1} in ${3:items1}
join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2} join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}
select ${8:$2.prop3} select ${8:$2.prop3}
where ${9:clause} where ${9:clause}
endsnippet endsnippet
############################ ############################
# feedback and debugging # # feedback and debugging #
############################ ############################
snippet da "Debug.Assert" b snippet da "Debug.Assert" b
Debug.Assert(${1:true}); Debug.Assert(${1:true});
endsnippet endsnippet
snippet cw "Console.WriteLine" b snippet cw "Console.WriteLine" b
Console.WriteLine("$1"); Console.WriteLine("$1");
endsnippet endsnippet
# as you first type comma-separated parameters on the right, {n} values appear in the format string # as you first type comma-separated parameters on the right, {n} values appear in the format string
snippet cwp "Console.WriteLine with parameters" b snippet cwp "Console.WriteLine with parameters" b
Console.WriteLine("${2:`!p Console.WriteLine("${2:`!p
snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))]) snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))])
`}"${1:, something}); `}"${1:, something});
endsnippet endsnippet
snippet mbox "Message box" b snippet mbox "Message box" b
MessageBox.Show("${1:message}"); MessageBox.Show("${1:message}");
endsnippet endsnippet
################## ##################
# full methods # # full methods #
################## ##################
snippet equals "Equals method" b snippet equals "Equals method" b
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj == null || GetType() != obj.GetType()) if (obj == null || GetType() != obj.GetType())
{ {
return false; return false;
} }
$0 $0
return base.Equals(obj); return base.Equals(obj);
} }
endsnippet endsnippet
############## ##############
# comments # # comments #
############## ##############
snippet /// "XML comment" b snippet /// "XML comment" b
/// <summary> /// <summary>
/// $1 /// $1
/// </summary> /// </summary>
endsnippet endsnippet