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

(Difference between pages)
 
m (more details)
 
Line 1: Line 1:
{{Ebuild
+
{{DISQUS}}
|Summary=Vim is an improved, vi-style text editor with many features.
+
|CatPkg=app-editors/vim
+
|Maintainer=
+
|Repository=Gentoo Portage Tree
+
}}
+
== Introduction ==
+
  
So you thought you could get by with gedit? Not when you must configure an application on your server in a data center two states away! When it comes to remote system administration, all roads lead back to Vim. Not a Vim expert? No problem, you just need a handful of commands to do everything you need to do.
+
Please keep DISQUS chats at the top of talk pages.
  
Entire books have been written about Vim, and they still fail to capture all of its functionality. But the core command set is all you really need if you're just making a few changes to a few files over SSH. You might not do it as efficiently as a Vim expert, but it's good enough to get the job done. In fact, if you're working with Vim (the pre-eminent vi-clone) on a server, there's a good chance it's "vim-tiny," a stripped-down Vim that offers the traditional vi functionality but not the full set of Vim features.
+
__TOC__
  
==Insert Mode==
 
The first thing you must grok is that Vim has several modes -- command mode, insert mode, visual mode, and last-line mode (also known as ex mode). When you start Vim, you'll be in command mode. Here, all of the keys are used to perform commands, not input text. To switch to input mode, hit <span style="color:green">i</span>, and you're able start editing the file, adding text, using Backspace, etc.
 
To return to command mode, hit <span style="color:green">Esc</span>. To enter last-line or Ex mode, use :, and then input the command you wish to enter.
 
  
==Vim Command Mode==
+
=== Fancy Boxes ===
I could go on for days about the commands needed in command mode, but we're just here for the basics, so let's look at movement. Movement is based on the standard alphabetic keys:
+
TODO: Describe fancy* boxes, and explain the most fool-proof way of using them. Use this format, exactly:
  
* '''h''' Move the cursor to the left one character.
+
{{fancyimportant|1=
* '''l''' Move the cursor to the right one character.
+
Now you can put lots of funky stuff in here, like <tt>html</tt> tags, etc, and not
* '''j''' Move the cursor down one line.
+
have a problem with the parameter getting passed as the first parameter.
* '''k''' Move the cursor up one line.
+
  
You can move faster by using <span style="color:green">b</span> and  <span style="color:green">w</span> to move backward and forward by one "word" at a time, respectively. Vim looks at "words" as a string of alphanumeric characters. So "eix" is a word, but "eix-sync" is multi-word because it's broken up by a non-alphanumeric character.
+
Cool!
 +
}}
  
You can also move from one "paragraph" to the other thanks to {{c|<nowiki>{</nowiki>}} and {{c|<nowiki>}</nowiki>}} that respectively move the cursor to the previous and next blank line.
+
=== watching pages ===
 +
we should have a section dedicated to explaining how to watch pages that an editor is knowledgeable about, and how to use the watch list to keep the pages clean, concise, and accurate.
 +
ie if i know about the web server stack i watch that, and pages related to that...  (i think i might need to turn off watching pages i touch automatically...)
  
Deleting is done with  <span style="color:green">d</span> or <span style="color:green">x</span>. To delete a single character, move the cursor over that character and use <span style="color:green">x</span>. Using <span style="color:green">dw</span> will delete the word the cursor is over, and <span style="color:green">db</span> will delete the previous word.
+
To watch, or unwatch a page:
 +
in the menu bar {{c|Actions > Watch}} or {{c|Actions > Unwatch}}
  
To delete an entire line, use <span style="color:green">dd</span>. To delete from the cursor to the end of the line, use <span style="color:green">d$</span>. To delete from the cursor to the beginning of the line, use <span style="color:green">d0</span>. The $ is shorthand for "end of the line," and 0 is shorthand for beginning of the line. You can also use ^ (shorthand for "first non-blank character of the line").
+
To display the watchlist:
 +
in the menu bar {{c|account > watchlist}}
  
To copy a line, use {{c|yy}} (yank). To copy from the cursor the the end of the line, use {{c|y$}}. To copy 3 lines, use {{c|3yy}}, ...
+
rss codes should be also generated to easily track the watch list so everyone gets pinged when a change occurs.  [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 03:55, March 27, 2015 (UTC)
  
Yanked lines are stored in a buffer, to paste the content of the buffer after the cursor, use {{c|p}}, to paste it before the cursor, use {{c|P}}. Note that {{c|d}} and {{c|x}} also copy the deleted content to the buffer.
+
=== Special Characters ===
  
==Search and Replace==
+
To produce pipes: <pre>{{!}}</pre>
To search through the document, use the / key to initiate a forward search, or ? to initiate a backward search.
+
generates: {{!}}
  
To search and replace, use <span style="color:green">:s</span> (substitute) with the range of lines and search terms. Like so:
+
To produce equals: <pre>{{=}}</pre>
<pre>
+
generates: {{=}}
:%s/old/new/
+
</pre>
+
  
The % means "global," but you can replace that with a range of lines, like this:
+
=== delete template ===
 +
to flag a page as a candidate for deletion, insert
 +
<pre>{{delete}}</pre>
 +
at the top of a page.
  
<pre>
+
{{delete}}
:1,15s/old/new/
+
[[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 16:54, 20 September 2014 (UTC)
</pre>
+
Another example of search/replace functions
+
<pre>Command        Outcome
+
:s/xxx/yyy/    Replace xxx with yyy at the first occurence
+
:s/xxx/yyy/g  Replace xxx with yyy first occurrence, global (whole sentence)
+
:s/xxx/yyy/gc  Replace xxx with yyy global with confirm
+
:%s/xxx/yyy/g  Replace xxx with yyy global in the whole file</pre>
+
+
I prefer to use the <span style="color:green">c</span> (confirm) and <span style="color:green">g</span> (global) options too, so when searching it will search the entire line and not just the first occurrence of a string.
+
  
A usual search would look something like :%s/old/new/gc, and when you hit Enter you'll be prompted before you make changes. I recommend using confirm; otherwise you can wind up with unexpected results.
+
=== Minor edits ===
 +
Check minor edits to note that your commit is a small commit. A minor edit can be filtered out of logs when searching through them.
  
If the "search" part of the substitute command is omitted, the last searched term will be used. The following exemple will search for the string "hello" and then substitute all "hello" occurrences by "salut".
+
=== video playlists ===
 +
i have several examples of how to embed playlists in [[Programming]] but there are no examples in how to wiki.  
  
<pre>/hello
+
=== links ===
:%s//salut/g</pre>
+
fixing a broken link brought this subject to my attention.
 +
[www.link.com is this a bug?] && [link.com shouldn't this work?] do not work...  brackets or not.
  
==Undo==
+
no protocol defined external links <nowiki>[//test.com //test.com]</nowiki> produces (use these style links)
What if you've made an edit you didn't want to make? Easy, use the undo <span style="color:green">u</span> command. If you didn't mean to undo what you did -- and it's easy to accidentally hit u -- use <span style="color:green">Ctrl-r</span> to redo the last change.
+
[//test.com //test.com]
Quick note: If Vim is in vi-compatibility mode, it will have only one "level" of undo. In normal Vim mode, you can undo many, many changes. But vi undoes only the most recent change.
+
  
==Saving, Quitting and More ...==
+
no bracket links:
One of the things that's severely non-obvious while working with Vim the first time is how do I get the heck out of here? You can quit Vim in a number of ways, but I'll show the most usual ones.
+
http://google.com
 
+
(regardless that this service only offers https)
First, if you want to save your changes before exiting Vim, use  <span style="color:green">:w</span> or save and exit in one action with <span style="color:green">:wq</span>.
+
Don't want to save your changes? It happens. No problem, just use <span style="color:green">:q!</span> if you realize that you've made some edits that you don't want to save, and they are too complex to easily undo before exiting. Note that you can also write changes to a different filename by using :w newfile.
+
 
+
This is just a short and sweet intro to Vim for emergencies or minimal usage. You could do much, much more with Vim if you wanted. Be sure to read through the Vim tutorial by running vimtutor, and look through Vim's documentation by running :help. But in a pinch, this list of commands should get you through.
+
 
+
== Good Starter Vimrc ==
+
 
+
The following file makes a very good starter <tt>.vimrc</tt> file. Place it in your home directory, and you will get true tabs (displayed indented 4 spaces) and you will be able to see all the whitespace in your document, which is handy when editing critical files:
+
 
+
{{file|name=~/.vimrc|desc=A good starter .vimrc file|body=
+
set noexpandtab
+
set shiftwidth=4
+
set tabstop=4
+
set listchars=eol:%,tab:>-,trail:~,extends:>,precedes:<
+
set list
+
filetype indent off
+
filetype plugin off
+
}}
+
 
+
By default, copying and pasting into a vim window will cause things to horribly auto-indent. To fix this, you can temporarily switch to "paste mode" before pasting with <span style="color:green">:set paste</span>. You will see <tt>-- INSERT (paste) --</tt> in the status bar when you are in insert mode. Don't forget to disable paste mode with <span style="color:green">:set nopaste</span> after pasting. You can also use bang to switch between "paste" and "nopaste" so that you just have to recall the last command : <span style="color:green">:set paste!</span>. ([http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste See also])
+
 
+
This is more often experienced while pasting text copied to the X clipboard, so a map that does the work is useful, if one doesn't want to turn off autoident.
+
{{file|name=~/.vimrc|desc=a map for pasting from the X clipboard avoiding autoindent|body=
+
<nowiki>map <leader>px :set paste<CR>"+p<ESC>:set nopaste<CR\></nowiki>
+
}}
+
If <leader> is set to the default backslash '\' the combination of keys '\px' pastes the text from the X clipboard(register +), setting paste mode temporarily, this requires a vim built with the "X" USE flag.
+
  
== Visual mode ==
+
=== Image Embedding ===
 +
To embed images:
 +
<pre>[[File:Nginx.gif|class=img-responsive|center]]</pre>
 +
[[File:Nginx.gif|class=img-responsive|center]]
  
I noticed that some of my friends that use Vim as their main editor, do not use the visual mode at all. However, it is of a great power and will save you a lot of time. Basically, it allows you to select some text (as you would do with your pointer in any graphic base editor) and process almost any command available from the command mode on the selected part.
+
=== how to talk pages ===
  
To switch to the visual mode, type {{c|v}} ({{c|<nowiki><Esc></nowiki>}} to go back to the command mode). Then you can move just as in the command mode ({{c|h}}, {{c|j}}, {{c|k}}, {{c|l}}, {{c|w}}, {{c|$}}, {{c|<nowiki>}</nowiki>}}, etc). If you want to delete the selection, type {{c|d}}. If you want to copy the selection, type {{c|y}}.
+
we need a section explaining how to indent for step2 of talk threads
 +
:ie conversation 2
 +
:: ie convo 3
 +
::: we need info on using tilde's to sign and date etc... noting that its good practice to sign with 4 ~
 +
{{tip| <pre>~~~ && ~~~~ && ~~~~~</pre> produces [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) && [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 22:41, 26 September 2014 (UTC) && 22:41, 26 September 2014 (UTC)}}
  
If you type {{c|:}}, you will notice that it automatically appends {{c|'<,'>}} in the command-line. This means that the following command will be applied in the range of the selection. If you append the following command {{c|s/foo/bar/g}}, all occurences of "foo", will be replaced by "bar" within the selection.
+
we need a note about user talk pages being a messaging system....  (i put a disqus on my talk page so i get email notifications when people say things to me) [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 22:41, 26 September 2014 (UTC)
  
When a command is processed, you go back to the command mode. Typing {{c|1v}} will restore the previous selection, starting from the current position of the cursor. The former is often useful when you work in "visual line" mode. To enter "visual line" mode, type {{c|V}} (upper V). This mode allows you to select lines instead of characters. This is especially useful when you want to delete a bunch of lines, large enough to take some time to count them all before typing {{c|17dd}} for instance.
+
=== template requests ===
 +
==== external resources ====
 +
I would like a sexy little widget for by the top of the page with links to: tldp, wikipedia, ohloh, cvedetails, github, sourceforge, etc with sexy little icons. It will make our pages feel more interwoven with the larger linux community. ;-) [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 23:30, 2 October 2014 (UTC)
  
There is also a "visual block" mode. This awesome mode, that you would probably not find in common non-text-based editors, allows you to select columns of text, instead of lines. While in "visual block" mode, type {{c|I}} to insert text before the selection, inserted text will be written on the first line, and repeated to the other lines after {{c|<nowiki><ESC</nowiki>}} is pressed.
+
http://www.cvedetails.com/vendor/12010/Mariadb.html
  
{{EbuildFooter}}
+
==== fortune of the day ====
 +
I'd like a daily fortune rotation on my user page to show im looney tunes ;-) [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) 23:30, 2 October 2014 (UTC)
  
[[Category:Editors]]
+
=== widget requests ===
 +
# http://www.mediawikiwidgets.org/Widget:Ohloh_Project for dynamic language summary on packages
 +
# http://www.mediawikiwidgets.org/Alexa <-this ones pretty rad
 +
# http://www.mediawikiwidgets.org/AddThis
 +
# adsense, the sites set for traffic, corporate sponsorship is a good idea.  https://www.mediawiki.org/wiki/Extension:Google_AdSense_2

Revision as of 04:16, March 27, 2015

blog comments powered by Disqus

Please keep DISQUS chats at the top of talk pages.


Fancy Boxes

TODO: Describe fancy* boxes, and explain the most fool-proof way of using them. Use this format, exactly:

Important

Now you can put lots of funky stuff in here, like html tags, etc, and not have a problem with the parameter getting passed as the first parameter.

Cool!

watching pages

we should have a section dedicated to explaining how to watch pages that an editor is knowledgeable about, and how to use the watch list to keep the pages clean, concise, and accurate. ie if i know about the web server stack i watch that, and pages related to that... (i think i might need to turn off watching pages i touch automatically...)

To watch, or unwatch a page: in the menu bar Actions > Watch or Actions > Unwatch

To display the watchlist: in the menu bar account > watchlist

rss codes should be also generated to easily track the watch list so everyone gets pinged when a change occurs. Threesixes (talk) 03:55, March 27, 2015 (UTC)

Special Characters

To produce pipes:
{{!}}

generates: |

To produce equals:
{{=}}

generates: =

delete template

to flag a page as a candidate for deletion, insert

{{delete}}

at the top of a page.

Warning

This page has been proposed for deletion because it does not meet the Editing Guidelines.
If you disagree, please discuss it here.

Threesixes (talk) 16:54, 20 September 2014 (UTC)

Minor edits

Check minor edits to note that your commit is a small commit. A minor edit can be filtered out of logs when searching through them.

video playlists

i have several examples of how to embed playlists in Programming but there are no examples in how to wiki.

links

fixing a broken link brought this subject to my attention. [www.link.com is this a bug?] && [link.com shouldn't this work?] do not work... brackets or not.

no protocol defined external links [//test.com //test.com] produces (use these style links) //test.com

no bracket links: http://google.com (regardless that this service only offers https)

Image Embedding

To embed images:

[[File:Nginx.gif|class=img-responsive|center]]
Nginx.gif

how to talk pages

we need a section explaining how to indent for step2 of talk threads

ie conversation 2
ie convo 3
we need info on using tilde's to sign and date etc... noting that its good practice to sign with 4 ~
Tip
~~~ && ~~~~ && ~~~~~
produces Threesixes (talk) && Threesixes (talk) 22:41, 26 September 2014 (UTC) && 22:41, 26 September 2014 (UTC)

we need a note about user talk pages being a messaging system.... (i put a disqus on my talk page so i get email notifications when people say things to me) Threesixes (talk) 22:41, 26 September 2014 (UTC)

template requests

external resources

I would like a sexy little widget for by the top of the page with links to: tldp, wikipedia, ohloh, cvedetails, github, sourceforge, etc with sexy little icons. It will make our pages feel more interwoven with the larger linux community. ;-) Threesixes (talk) 23:30, 2 October 2014 (UTC)

http://www.cvedetails.com/vendor/12010/Mariadb.html

fortune of the day

I'd like a daily fortune rotation on my user page to show im looney tunes ;-) Threesixes (talk) 23:30, 2 October 2014 (UTC)

widget requests

  1. http://www.mediawikiwidgets.org/Widget:Ohloh_Project for dynamic language summary on packages
  2. http://www.mediawikiwidgets.org/Alexa <-this ones pretty rad
  3. http://www.mediawikiwidgets.org/AddThis
  4. adsense, the sites set for traffic, corporate sponsorship is a good idea. https://www.mediawiki.org/wiki/Extension:Google_AdSense_2