Difference between pages "Package:Vim" and "Subarches"

(Difference between pages)
 
 
Line 1: Line 1:
{{Ebuild
+
{{:Install/Header}}
|Summary=Vim is an improved, vi-style text editor with many features.
+
= Funtoo Linux Sub-Architectures =
|CatPkg=app-editors/vim
+
__NOTITLE__
|Maintainer=
+
This page provides an overview of Funtoo Linux sub-architectures (also called ''subarches'') designed for quick and easy reference. Funtoo Linux provides optimized installation images for all sub-architectures listed below. See the [[Funtoo Linux Installation|Funtoo Linux Installation Guide]] to install Funtoo Linux.
|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.
+
The cpuid application can be used to help identify your processor and it's microarchitecture.
 +
<console>
 +
sudo emerge cpuid; cpuid | tail -n 1
 +
</console>
  
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.
+
== 64-bit PC-Compatible ==
  
==Insert Mode==
+
{{TableStart}}
The first thing you must grok is that Vim has several modes -- command mode, insert 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.
+
<tr><th class="warn" colspan="3">64-bit AMD Processors</th></tr>
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.
+
{{#ask:[[CPU Family::64-bit AMD Processors]]
 
+
|?#
==Vim Command Mode==
+
|?Subarch
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:
+
|?CFLAGS
 
+
|?Description
* '''h''' Move the cursor to the left one character.
+
|format=template
* '''l''' Move the cursor to the right one character.
+
|link=none
* '''j''' Move the cursor down one line.
+
|headers=hide
* '''k''' Move the cursor up one line.
+
|searchlabel=... further results
 
+
|sep=,
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.
+
|template=SubarchList
 
+
}}
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.
+
<tr><th class="warn" colspan="3">64-bit Intel Processors</th></tr>
 
+
{{#ask:[[CPU Family::64-bit Intel Processors]]
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 ^.
+
|?#
 
+
|?Subarch
==Copying and Pasting in Vim==
+
|?CFLAGS
Let's look at copying and pasting real quick. To highlight text to copy, use the <span style="color:green">v</span>, <span style="color:green">V</span> and <span style="color:green">Ctrl-V</span> commands. You might have guessed by now that Vim commands are case-sensitive, So v and V are different things.
+
|?Description
 
+
|format=template
The <span style="color:green">v</span> command simply allows you to highlight changes character by character using the movement (hljk and others) or arrow keys. The <span style="color:green">v</span> command highlights entire lines. And the <span style="color:green">Ctrl-v</span> command highlights blocks of text -- very useful for highlighting and copying columns of text.
+
|link=none
 
+
|headers=hide
Once you've highlighted the text you want to copy, hit <span style="color:green">y</span> to "yank" the text into the buffer.
+
|searchlabel=... further results
 
+
|sep=,
To paste the text, use <span style="color:green">p</span> or <span style="color:green">P</span> to paste. The p command will paste after the cursor, and P pastes before the cursor.
+
|template=SubarchList
==Search and Replace==
+
}}
To search through the document, use the / key to initiate a forward search, or ? to initiate a backward search.
+
<tr><th class="warn" colspan="3">64-bit PC-Compatible (Generic) Processors</th></tr>
 
+
{{#ask:[[CPU Family::64-bit Processors (PC-Compatible, Generic)]]
To search and replace, use <span style="color:green">:s</span> with the range of lines and search terms. Like so:
+
|?#
<pre>
+
|?Subarch
:%s/old/new/
+
|?CFLAGS
</pre>
+
|?Description
 
+
|format=template
The % means "global," but you can replace that with a range of lines, like this:
+
|link=none
 
+
|headers=hide
<pre>
+
|searchlabel=... further results
:1,15s/old/new/
+
|sep=,
</pre>
+
|template=SubarchList
Another example of search/replace functions
+
}}
<pre>Command        Outcome
+
{{TableEnd}}
: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.
+
 
+
==Undo==
+
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.
+
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 ...==
+
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.
+
 
+
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
+
{{EbuildFooter}}
+

Revision as of 10:08, December 20, 2014

Funtoo Linux Sub-Architectures

This page provides an overview of Funtoo Linux sub-architectures (also called subarches) designed for quick and easy reference. Funtoo Linux provides optimized installation images for all sub-architectures listed below. See the Funtoo Linux Installation Guide to install Funtoo Linux.

The cpuid application can be used to help identify your processor and it's microarchitecture.

sudo emerge cpuid; cpuid | tail -n 1

64-bit PC-Compatible

64-bit AMD Processors
amd64-bulldozerThe amd64-bulldozer subarch supports the AMD bulldozer microarchitecture CPUs, which were released from late 2011 through the first quarter of 2012 as a replacement for the K10 microarchitecture CPUs.-march=bdver1 -O2 -pipe
amd64-jaguarAMD jaguar microarchitecture debuted in mid-2013 and is targeted at low-power devices, including notebooks, tablets and small form-factor desktops and servers. It is perhaps most well-known for being the microarchitecture used for the Playstation 4 and Xbox One,-march=btver2 -O2 -pipe
amd64-k10The amd64-k10 subarch provides support for the AMD Family 10h processors, which were released in late 2007 as a successor to the AMD K8 series processors.-march=amdfam10 -O2 -pipe
amd64-piledriverThe amd64-piledriver subarch supports the AMD Piledriver microarchitecture produced by AMD from mid-2012 through 2015, which is the successor to the AMD bulldozer microarchitecture.-march=bdver2 -O2 -pipe
amd64-steamrollerThe amd64-steamroller subarch supports the AMD steamroller microarchitecture, produced from early 2014. It is the successor to the AMD Piledriver microarchitecture.-march=bdver3 -O2 -pipe
64-bit Intel Processors
atom_64The atom_64 sub-architecture supports 64-bit capable Intel Atom CPUs.-O2 -fomit-frame-pointer -march=atom -pipe
core2-64The core2_64 subarch supports 64-bit-capable processors based on the Core microarchitecture and all processors of the Penryn microarchitecture. This includes all Intel Core 2 branded processors, some Celeron, some Pentium and some Xeon branded processors.-march=core2 -O2 -pipe
corei7The corei7 subarch supports the Nehalem, Westmere, Sandy_Bridge, Ivy Bridge, and Haswel microarchitecture-based Intel Pentium/Celeron, Intel Core i3, i5, i7 and Xeon Processors.-march=corei7 -O2 -pipe
intel64-haswellThe intel64-haswell subarch specifically supports processors based on Intel's Haswell microarchitecture. Haswell desktop processors are branded as 4th Generation Intel Core i3, Core i5, and Core i7 Processors.-march=core-avx2 -O2 -pipe
64-bit PC-Compatible (Generic) Processors
generic_64The generic_64 subarch is designed to support 64-bit PC-compatible CPUs, such as the AMD K8-series processors, which were introduced in late 2003.-mtune=generic -O2 -pipe