Difference between pages "Help:Funtoo Editing Guidelines" and "Package:Vim/Cheatsheet"

(Difference between pages)
m (<console>: revert console changes i made, root was botched and im not sure drobbins approved of it. see talk page if you want to enforce it drobbins.)
 
m (Actions)
 
Line 1: Line 1:
This guide is meant to serve as a reference for those who are interested in helping improve the Funtoo wiki.  
+
* The description given in the "description" column is rather short, often it is best to try it your self and see what it actually does.
 +
* Even if not specified in the "command" column, most commands fired in normal mode accept a "<num> prefix" (Eg. `5w` is equivalent to `wwwww`).
 +
* Most commands will work in visual mode as well as in normal mode.
  
= document hierarchy structure =
+
== Deplacements ==
<pre>= document hierarchy structure =</pre>
+
== document hierarchy sub structure ==
+
<pre>== document hierarchy sub structure ==</pre>
+
this is the primary structure most pages, talk pages will use instead of main heading example above.  some pages will call for main heading.
+
=== document hierarchy sub sub structure ===
+
<pre>=== document hierarchy sub sub structure ===</pre>
+
==== document hierarchy sub sub sub structure ====
+
  
<pre>==== document hierarchy sub structure ====</pre>
 
  
to implement pipe {{!}} in documents, wrap with brackets.
+
{{TableStart|striped=true}}
<pre>{{!}}</pre>
+
<tr>
 +
  <th>command</th>
 +
  <th>meaning</th>
 +
  <th>description</th>
 +
</tr>
 +
<tr>
 +
  <td>w</td>
 +
  <td>word</td>
 +
  <td>move to next word</td>
 +
</tr>
 +
<tr>
 +
  <td>W</td>
 +
  <td>Word</td>
 +
  <td>move to the next word (broad sens)</td>
 +
</tr>
 +
<tr>
 +
  <td>b</td>
 +
  <td>begin</td>
 +
  <td>move to the previous word beginning</td>
 +
</tr>
 +
<tr>
 +
  <td>B</td>
 +
  <td>Begin</td>
 +
  <td>move to the previous word beginning (broad sense)</td>
 +
</tr>
 +
<tr>
 +
  <td>e</td>
 +
  <td>end</td>
 +
  <td>move to the next word end</td>
 +
</tr>
 +
<tr>
 +
  <td>E</td>
 +
  <td>End</td>
 +
  <td>move to the next word end (broad sense)</td>
 +
</tr>
 +
<tr>
 +
  <td><nowiki>{</nowiki></td>
 +
  <td></td>
 +
  <td>move to the previous blank line</td>
 +
</tr>
 +
<tr>
 +
  <td><nowiki>}</nowiki></td>
 +
  <td></td>
 +
  <td>move to the next blank line</td>
 +
</tr>
 +
<tr>
 +
  <td>f<char></td>
 +
  <td>fetch</td>
 +
  <td>move to the next occurrence of the character <char></td>
 +
</tr>
 +
<tr>
 +
  <td>F<char></td>
 +
  <td>Fetch</td>
 +
  <td>move to the previous occurrence of the character <char></td>
 +
</tr>
 +
<tr>
 +
  <td>$</td>
 +
  <td></td>
 +
  <td>move to the end of the line</td>
 +
</tr>
 +
<tr>
 +
  <td>^</td>
 +
  <td></td>
 +
  <td>move to the first non-whitespace character of the line</td>
 +
</tr>
 +
<tr>
 +
  <td>zz</td>
 +
  <td></td>
 +
  <td>center the viewport on the currently</td>
 +
</tr>
 +
<tr>
 +
  <td><num>gg</td>
 +
  <td>goto</td>
 +
  <td>move to line number <num> (default is 1 if <num> is omitted)</td>
 +
</tr>
 +
<tr>
 +
  <td>G</td>
 +
  <td></td>
 +
  <td>move to the last line</td>
 +
</tr>
 +
<tr>
 +
  <td>C-o</td>
 +
  <td></td>
 +
  <td>Go to the previous cursor position</td>
 +
</tr>
 +
{{TableEnd}}
  
{{fancyimportant|below template is not instated yet}}
+
== Switch to insert mode ==
to use equals signs with out conflicting with document structure wrap with brackets.
+
<pre>{{=}}</pre>
+
  
{{=}} http://en.wikipedia.org/wiki/Template:%3D
+
{{TableStart|striped=true}}
 +
<tr>
 +
  <th>command</th>
 +
  <th>meaning</th>
 +
  <th>description</th>
 +
</tr>
 +
<tr>
 +
  <td>i</td>
 +
  <td>insert</td>
 +
  <td>insert before the cursor</td>
 +
</tr>
 +
<tr>
 +
  <td>I</td>
 +
  <td>Insert</td>
 +
  <td>insert at the beginning of the line (= <code>^i</code>)</td>
 +
</tr>
 +
<tr>
 +
  <td>a</td>
 +
  <td>append</td>
 +
  <td>insert after the cursor/td>
 +
</tr>
 +
<tr>
 +
  <td>A</td>
 +
  <td>Append</td>
 +
  <td>insert at the end of the line (= <code>$a</code>)</td>
 +
</tr>
 +
<tr>
 +
  <td>o</td>
 +
  <td></td>
 +
  <td>insert on a new blank line after the current line</td>
 +
</tr>
 +
<tr>
 +
  <td>O</td>
 +
  <td></td>
 +
  <td>insert on a new blank line before the current line</td>
 +
</tr>
 +
<tr>
 +
  <td>s</td>
 +
  <td>substitute</td>
 +
  <td>remove the current character and instert instead (= <code>xi</code>)</td>
 +
</tr>
 +
<tr>
 +
  <td>S</td>
 +
  <td>Substitute</td>
 +
  <td>remove the current line and insert instead (= <code>ddi</code></td>
 +
</tr>
 +
<tr>
 +
  <td>R</td>
 +
  <td>Replace</td>
 +
  <td>insert and override on the fly</td>
 +
</tr>
 +
{{TableEnd}}
  
== &#60;console&#62; ==
+
== Actions ==
To display console output, use the <tt>&#60;console&#62;</tt> tag:
+
  
For a root console:
+
{{TableStart|striped=true}}
<pre>
+
<tr>
<console>
+
  <th>command</th>
###i## run a command as root
+
  <th>meaning</th>
</console>
+
  <th>description</th>
</pre>
+
</tr>
Produces:
+
<tr>
<console>
+
  <td><num>dd</td>
###i## run a command as root
+
  <td>delete</td>
</console>
+
  <td>delete <num> lines</td>
 
+
</tr>
{{Fancyimportant|The <tt>##i##</tt> text tags the rest of the line as being ''user input'' ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.}}
+
<tr>
 
+
  <td><num>yy</td>
Examples of usage:
+
  <td>yank</td>
* [[Rootfs over encrypted lvm]]
+
  <td>copy <num> lines to vim's default buffer</td>
* [[Boot-Update]]
+
</tr>
* [[Fonts]]
+
<tr>
For a non-root console:
+
  <td>x</td>
<pre>
+
  <td></td>
<console>
+
  <td>remove the character under the cursor</td>
$ ##i##run a command as user
+
</tr>
</console>
+
<tr>
</pre>
+
  <td><num>p</td>
Produces:
+
  <td>paste</td>
<console>
+
  <td>paste <num> times vim's default buffer after the cursor</td>
$ ##i##run a command as user
+
</tr>
</console>
+
<tr>
 
+
  <td><num>P</td>
{{fancyimportant|1=
+
  <td>Paste</td>
Note that we use a <tt>#</tt> prompt for <tt>root</tt> and a <tt>$</tt> prompt to denote a non-root user.}}
+
   <td>paste <num> times vim's default buffer before the cursor</td>
 
+
</tr>
Examples of usage:
+
<tr>
* [[Zope HOWTO]]
+
  <td><code>~</code> (tilde)</td>
* [[Benchmarking]]
+
  <td></td>
 
+
  <td>swap case under the cursor</td>
or a more concise syntax
+
</tr>
 
+
<tr>
== Fancy Notes ==
+
  <td>.</td>
notes, warnings, tips, and important templates will help bring emphasis to articles drawn up.
+
  <td></td>
<pre>{{fancynote|this is a fancy note}}</pre><br />
+
  <td>repeat previous action (kind of "live macro", try it yourself and see)</td>
{{fancynote|this is a fancy note}}<br />
+
</tr>
 
+
<tr>
<pre>{{fancyimportant|this is a fancy important}}</pre><br />
+
  <td>/<pattern><CR></td>
{{fancyimportant|this is a fancy important}}<br />
+
  <td></td>
 
+
  <td>search next occurrence of <pattern></td>
<pre>{{fancywarning|this is a fancy warning}}</pre><br />
+
</tr>
{{fancywarning|this is a fancy warning}}<br />
+
<tr>
 
+
  <td>?<pattern><CR></td>
<pre>{{fancytip|this is a fancy tip}}</pre><br />
+
  <td></td>
{{fancytip|this is a fancy tip}}<br />
+
  <td>search previous occurrence of <pattern></td>
 
+
</tr>
 
+
<tr>
<pre>bridge returns will help you edit articles also <br /> starts a new line</pre><br />
+
  <td>*</td>
bridge returns will help you edit articles also <br /> starts a new line
+
  <td></td>
 
+
  <td>look for the next occurrence of the word under the cursor</td>
== &#123;&#123;Kernelop&#125;&#125; ==
+
</tr>
To display kernel options, we encourage you to use the <tt>kernelop</tt> template. To use the <tt>kernelop</tt> template, create an entry similar to the following example:
+
<tr>
<pre>
+
  <td>n</td>
{{kernelop|title=foo,bar|desc=
+
  <td></td>
kernel options pasted from "make menuconfig"
+
  <td>forward search last searched pattern</td>
<&#47;pre>}}
+
</tr>
</pre>
+
<tr>
 
+
  <td>N</td>
Adding this entry will give you the following output:
+
  <td></td>
{{kernelop|title=foo,bar|desc=
+
  <td>backward search last searched pattern</td>
kernel options
+
</tr>
}}
+
{{TableEnd}}
 
+
Here's a more concrete example:
+
{{kernelop|title=File systems|desc=
+
<M> Second extended fs support         
+
[ ]   Ext2 extended attributes         
+
[ ]  Ext2 execute in place support   
+
<M> Ext3 journalling file system support
+
}}
+
 
+
Examples of usage:
+
* [[Fglrx]]
+
* [[Acpid]]
+
* [[Microcode]]
+
 
+
== links ==
+
 
+
internal:<pre>[[pagename]]</pre><br />
+
[[pagename]]<br />
+
internal with text:<pre>[[pagename|some text]]</pre><br />
+
[[pagename|some text]]<br />
+
external: <pre>[http://funtoo.org/ http://funtoo.org/]</pre><br />
+
[http://funtoo.org/ http://funtoo.org/]<br />
+
external with text: <pre>[http://funtoo.org/ this is some text]</pre><br />
+
[http://funtoo.org/ this is some text]
+
 
+
== Displaying Source Code ==
+
 
+
To display source code, use the <tt>&#60;syntaxhighlight&#62;</tt> tag, which has the ability to perform syntax highlighting on the source code for easier reading:
+
<pre>
+
<syntaxhighlight lang="python">
+
import system
+
</syntaxhighlight>
+
</pre>
+
 
+
This will produce the following output:
+
 
+
<syntaxhighlight lang="python">
+
import system
+
</syntaxhighlight>
+
 
+
 
+
Note that the language should be specified in the <tt>lang</tt> attribute. For a list of supported languages, see [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages this list].
+
 
+
== Displaying Files ==
+
To display the contents of a file that is not source code, use the <&#47;pre> tag. The <&#47;pre> tag preserves formatting. Example file contents:
+
 
+
<pre>
+
foo
+
bar
+
oni
+
</pre>
+
 
+
 
+
Examples of usage:
+
* [[UEFI Install Guide]]
+
* [[MediaWiki]]
+
* [[Clang]]
+
 
+
== &#60;tt&#62; and &#60;code&#62; ==
+
To emphasize filenames, commands, and other technical jargon when they appear inline in a paragraph, use the  <tt>&#60;tt&#62;</tt> or <tt>&#60;code&#62;</tt> option. To use these, follow the example below:
+
<pre>
+
The <tt>/etc/fstab</tt> file is an important one. Another important file is <code>/boot/grub/grub.cfg</code>.
+
</pre>
+
 
+
This example produces the following output (notice the difference between the fonts?): <br> The <tt>/etc/fstab</tt> file is an important one. Another important file is <code>/boot/grub/grub.cfg</code>.
+
 
+
== Collapsible text ==
+
 
+
<pre><div class="toccolours mw-collapsible"> some text you might want to fold away because its a huge explanation.</div></pre><br />
+
 
+
<div class="toccolours mw-collapsible"> some text you might want to fold away because its a huge explanation.</div><br />
+
 
+
<pre><div class="toccolours mw-collapsible mw-collapsed">pre collapsed text because it is a huge explanation.</div></pre><br />
+
 
+
<div class="toccolours mw-collapsible mw-collapsed">pre collapsed text because it is a huge explanation.</div>
+
 
+
== Screencasting ==
+
screencasting is an easy method to explain complex tasks.  take for instance youtu.be/5KDei5mBfSg we chop off the id and insert it into the following syntax to produce a video example.<br />
+
tiny:
+
<pre>{{#widget:YouTube|id=5KDei5mBfSg|width=320|height=180}}</pre>
+
standard:
+
<pre>{{#widget:YouTube|id=5KDei5mBfSg|width=700|height=420}}</pre>
+
{{#widget:YouTube|id=5KDei5mBfSg|width=700|height=420}}
+
 
+
[[Category:Wiki Development]]
+

Latest revision as of 21:22, April 7, 2015

  • The description given in the "description" column is rather short, often it is best to try it your self and see what it actually does.
  • Even if not specified in the "command" column, most commands fired in normal mode accept a "<num> prefix" (Eg. `5w` is equivalent to `wwwww`).
  • Most commands will work in visual mode as well as in normal mode.

Deplacements

command meaning description
w word move to next word
W Word move to the next word (broad sens)
b begin move to the previous word beginning
B Begin move to the previous word beginning (broad sense)
e end move to the next word end
E End move to the next word end (broad sense)
{ move to the previous blank line
} move to the next blank line
f<char> fetch move to the next occurrence of the character <char>
F<char> Fetch move to the previous occurrence of the character <char>
$ move to the end of the line
^ move to the first non-whitespace character of the line
zz center the viewport on the currently
<num>gg goto move to line number <num> (default is 1 if <num> is omitted)
G move to the last line
C-o Go to the previous cursor position

Switch to insert mode

command meaning description
i insert insert before the cursor
I Insert insert at the beginning of the line (= ^i)
a append insert after the cursor/td>
A Append insert at the end of the line (= $a)
o insert on a new blank line after the current line
O insert on a new blank line before the current line
s substitute remove the current character and instert instead (= xi)
S Substitute remove the current line and insert instead (= ddi
R Replace insert and override on the fly

Actions

command meaning description
<num>dd delete delete <num> lines
<num>yy yank copy <num> lines to vim's default buffer
x remove the character under the cursor
<num>p paste paste <num> times vim's default buffer after the cursor
<num>P Paste paste <num> times vim's default buffer before the cursor
~ (tilde) swap case under the cursor
. repeat previous action (kind of "live macro", try it yourself and see)
/<pattern><CR> search next occurrence of <pattern>
?<pattern><CR> search previous occurrence of <pattern>
* look for the next occurrence of the word under the cursor
n forward search last searched pattern
N backward search last searched pattern