Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: exhuma/vimtalk
base: 4cb5ef5a31
...
head fork: exhuma/vimtalk
compare: 38306a1ec6
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
166 session-01/README.rst
@@ -176,10 +176,17 @@ Examples/Showcase
Block select + Insert
---------------------
-**TODO**
+This can be useful to comment out a block of code.
+
+Example file
+ ``examples/javascript.js``
-Other useful shortcuts
-----------------------
+1. Select a block of text using ``CTRL+V``
+2. Either type ``Shift+I`` or ``Shift+A`` to insert text
+3. Confirm using either ``<ESC>`` or ``CTRL+[``
+
+Useful shortcuts
+----------------
``gf``
Goto file under cursor
@@ -196,50 +203,60 @@ Other useful shortcuts
``CTRL+T``
Indent current line while in insert mode
-**TODO**
+``*``/``#``
+ Find the word under the cursor (forwards/backwards)
-Copy(Yank)/Paste
-----------------
+``gqq``
+ Automatically format the current line
-::
+``VISUAL: gq``
+ Automatically format the selected text
- NORMAL: yy, y{motion}
- VISUAL: y
- NORMAL: p/P
+``CTRL+N``/``CTRL+P``
+ Text completion ([N]ext, [P]revious). It is very naïve and only looks for
+ words in all open buffers.
-**TODO**
+Copy (Yank) / Paste
+-------------------
-Navigation
-----------
+Copying can be done either in normal or visual mode:
+Normal
+ * ``yy``: yank the current line
+ * ``y{motion or text-object}``: yank the mentioned text-object
-**TODO**
+Visual
+ * ``y``: Yank the selected text
-Quick commands
---------------
+Normal
+ * ``p``: Paste below the current line
+ * ``Shift+P``: Paste above the current line
-**TODO**
+Navigation
+----------
-* Quicksearch::
+``h``, ``j``, ``k`` and ``l`` as navigation keys!
- *
- #
+Macros
+------
-* Text formatting::
+``qa``
+ Start a macro recording (``a``) is a named register. It can be any
+ alphabetic letter. In other words, you can record up to 26 macros!
- NORMAL: gqq
- VISUAL: gq
+ From this point on *all* key presses will be recorded into the named macro
+ and can be replayed later
-**TODO**
+``q``
+ Stop recording.
-Macros
-------
+``@a``
+ Play the macro stored in register ``a``.
-**TODO**
+``@@``
+ Re-execute the last executed macro.
-* SQL Transformation
-**TODO**
Folding
-------
@@ -308,8 +325,8 @@ buffers, windows, splits and tabs
**TODO**
-cheat sheets
-------------
+Appendix I - Cheat Sheets
+=========================
* ``:viusage``
* http://michaelgoerz.net/refcards/vimqrc.pdf
@@ -317,4 +334,91 @@ cheat sheets
* http://michael.peopleofhonoronly.com/vim/
* http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/
+Appendix II - Example Macro
+===========================
+
+Convert a SELECT Statement to a Java class with getters and setters
+-------------------------------------------------------------------
+
+* Open the file examples/sql.sql::
+
+ :e examples/sql.sql
+
+* Yank the line containing the SELECT statement::
+
+ /SELECT<CR>yy
+
+* Open a new file::
+
+ :e Client.java
+
+* Paste the line::
+
+ <SHIFT+P>
+
+* Yank the name of the table (the last word)::
+
+ $Bye
+
+* Add a new line below this one, and insert the class statement::
+
+ o
+ public class<ESC>
+
+* Paste the table name, and uppercase the first character::
+
+ pb~
+
+* Add the beginning and ending braces::
+
+ A{<CR>}<ESC>
+
+* Go back to the first line (the SELECT statement), and extract the field names::
+
+ gg
+ dw
+ /FROM<CR>
+ hD
+
+* Move the line below the "class" line (delete + paste)::
+
+ ddp
+
+* Replace all occurences of ``", "`` with a newline::
+
+ V
+ :s/, /<CTRL+V><CR>/g
+
+* Jump back to the original position::
+
+ ggj
+
+* Start the macro::
+
+ qq
+
+* Record the following actions::
+
+ "tye
+ I<CTRL+t>
+ public String get<ESC>
+ l~
+ A(){<CR>
+ return this.<CTRL+R>t;<CR>
+ }<CR><CR>
+ public void set<CTRL+R>t<ESC>
+ Blll~
+ A(String<SPACE>
+ <CTRL+R>t
+ ){<CR>
+ this.<CTRL+R>t = <CTRL+R>t;<CR>
+ }<CR><ESC>
+ j0
+ q
+
+* This macro can now be executed by positioning the cursor on the beginning of
+ the next field (should be already the case), and by typing ``@q``.
+ This macro makes sure that the cursor position after executing it allows us
+ to execute it again without moving the cursor. This in turn allows us to
+ repeat the macro (for example 10 times) by typing ``10@q``.
View
23 session-01/examples/html.html
@@ -0,0 +1,23 @@
+{% extends "base.html" %}
+{% block title %}Device List{% endblock %}
+{% block content %}
+<h1>Device List</h1>
+
+<table>
+ <thead>
+ <tr>
+ <th>Hostname</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for device in devices %}
+ <tr>
+ <td><a href="{{url_for('device', device_name=device.hostname)}}">{{ device.hostname }}</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+{% endblock %}
+
+{# vim: set filetype=jinja : #}
View
29 session-01/examples/javascript.js
@@ -0,0 +1,29 @@
+/** Updates the devices combobox.
+ *
+ * @param {string} ctName The name of the CT.
+ * @param {Object} opt_default The entry which should be selected by default.
+ */
+ipbase.views.ReservePort.prototype.updateDevices = function(ctName, opt_default) {
+ var that = this;
+ var location_id = ctName.replace(
+ new RegExp(ipbase.model.ct.prototype.SIMPLE_ROW_FORMAT), '$1');
+ goog.dom.forms.setValue(goog.dom.getElement('location'), location_id);
+ var ct = new ipbase.model.ct(location_id);
+ ct.devices(function(devices) {
+ if (this.device_selector === null) {
+ that.logger.warning('Device selector is null!');
+ return;
+ }
+
+ that.device_selector.removeAllItems();
+ for (var i in devices) {
+ that.device_selector.addItem(
+ new goog.ui.ComboBoxItem(devices[i].hostname, devices[i]));
+ }
+
+ if (goog.isDefAndNotNull(opt_default)) {
+ // @todo: add 'replacement' (part of PK)
+ that.device_selector.setValue(opt_default.hostname);
+ }
+ });
+}
View
11 session-01/examples/sql.sql
@@ -0,0 +1,11 @@
+CREATE TABLE client (
+ email varchar(128) NOT NULL PRIMARY KEY,
+ first_name varchar(20),
+ last_name varchar(20),
+ tel varchar(10)
+);
+
+
+SELECT email, first_name, last_name, tel FROM client;
+
+

No commit comments for this range

Something went wrong with that request. Please try again.