TASK: Fix highlighting

This commit is contained in:
Daniel Siepmann 2018-10-24 18:05:30 +02:00
parent 9f6592b100
commit c67a381982
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -10,22 +10,22 @@ Welcome
First things first, how to start and *quit* Vim. First things first, how to start and *quit* Vim.
To start Vim, just type `vim` into the terminal. To start Vim, just type ``vim`` into the terminal.
To exit Vim, try `CTRL+C` like for nearly all CLIs. Vim will display a help message To exit Vim, try ``CTRL+C`` like for nearly all CLIs. Vim will display a help message
in the bottom left with instructions how to quit Vim: in the bottom left with instructions how to quit Vim:
Type :qa! and press <Enter> to abandon all changes and exit Vim Type :qa! and press <Enter> to abandon all changes and exit Vim
So lets type in `:qa!` to quit Vim again. So lets type in `:qa!`` to quit Vim again.
Settings Settings
-------- --------
By default Vim comes with no useful settings. Most developers like line numbers which By default Vim comes with no useful settings. Most developers like line numbers which
can be turned on by typing `:set number`. can be turned on by typing ``:set number``.
Run `vim lorem-ipsum.md` and type `:set number` to activate line numbers. Run ``vim lorem-ipsum.md`` and type ``:set number`` to activate line numbers.
If you quit Vim and re open the file, line numbers are gun. Settings adjusted within If you quit Vim and re open the file, line numbers are gun. Settings adjusted within
a session are not persisted. We get back to that later. a session are not persisted. We get back to that later.
@ -42,13 +42,13 @@ What is a mode?
NORMAL NORMAL
^^^^^^ ^^^^^^
This is the default mode when you start Vim. If you open a file, e.g. `vim lorem-ipsum.md` This is the default mode when you start Vim. If you open a file, e.g. ``vim lorem-ipsum.md``
keys are used to navigate in this file. E.g. use `h`, `j`, `k` and `l` to move the keys are used to navigate in this file. E.g. use ``h``, ``j``, ``k`` and ``l`` to move the
cursor around. cursor around.
TASK: Navigate a bit within `lorem-ipsum.md`. TASK: Navigate a bit within ``lorem-ipsum.md``.
Press `ESC` from any mode to come back to the `NORMAL` mode. Press ``ESC`` from any mode to come back to the ``NORMAL`` mode.
VISUAL VISUAL
^^^^^^ ^^^^^^
@ -58,19 +58,19 @@ with the highlighted parts.
You can enter different Visual Modes, e.g. You can enter different Visual Modes, e.g.
`v` ``v``
Will start `VISUAL` mode where you can highlight stuff using the same keys as in Will start ``VISUAL`` mode where you can highlight stuff using the same keys as in
`NORMAL` Mode. ``NORMAL`` Mode.
TASK: Highlight line 19. TASK: Highlight line 19.
`V` ``V``
`VISUAL LINE` to highlight lines, useful for presentations. ``VISUAL LINE`` to highlight lines, useful for presentations.
TASK: Highlight line 19. TASK: Highlight line 19.
`CTRL+v` ``CTRL+v``
`VISUAL BLOCK` to highlight blocks, useful for tables. ``VISUAL BLOCK`` to highlight blocks, useful for tables.
TASK: Highlight column 2. TASK: Highlight column 2.
@ -79,18 +79,18 @@ INSERT
Insert some text, keys will be passed through as insertions. Insert some text, keys will be passed through as insertions.
Enter the `INSERT` mode by one of the following keys: Enter the ``INSERT`` mode by one of the following keys:
`a` ``a``
Append behind the cursor Append behind the cursor
`i` ``i``
Insert at the cursor Insert at the cursor
`A` ``A``
Append at the end if line Append at the end if line
`I` ``I``
Insert at beginning of the line Insert at beginning of the line
TASK: Insert todays date at the end of the file. TASK: Insert todays date at the end of the file.
@ -100,11 +100,11 @@ REPLACE
Replace some text, keys will be passed through as replacements. Replace some text, keys will be passed through as replacements.
`r` ``r``
Replaces a single character. Replaces a single character.
`R` ``R``
Switches to `REPLACE` mode. Switches to ``REPLACE`` mode.
TASK: Replace last line with todays date. TASK: Replace last line with todays date.
@ -113,9 +113,9 @@ COMMAND
Executes commands within Vim, e.g. adjust settings or quit. Executes commands within Vim, e.g. adjust settings or quit.
`:` ``:``
Inserts the command mode. The cursor will be set to the command line. Inserts the command mode. The cursor will be set to the command line.
The command mode has auto completion, just press `TAB`. The command mode has auto completion, just press ``TAB``.
TASK: Activate line numbers, quit Vim. TASK: Activate line numbers, quit Vim.
@ -124,17 +124,17 @@ And there are more Modes.
Better movement Better movement
--------------- ---------------
So far we now that we can move around in `NORMAL` mode with `h`, `j`, `k` and `l`. So far we now that we can move around in ``NORMAL`` mode with `h``, ``j`, ``k`` and ``l``.
There are more keys to move around. E.g.: There are more keys to move around. E.g.:
`G` ``G``
Go to end of file. Go to end of file.
`gg` ``gg``
Go to beginning of file. Go to beginning of file.
Most movements can be prefixed with a count, that's called Vim Grammar. So to move to Most movements can be prefixed with a count, that's called Vim Grammar. So to move to
Line x type `xG`. Line x type ``xG``.
TASK: Highlight Line 19 by jumping to Line 19. TASK: Highlight Line 19 by jumping to Line 19.
@ -145,7 +145,7 @@ out yourself.
Help Help
---- ----
Vim has a huuuuge documentation on board. This can be accessed via `:help`. Vim has a huuuuge documentation on board. This can be accessed via ``:help``.
The help consists of a guide, reference, topics and plugins. The help consists of a guide, reference, topics and plugins.
@ -155,9 +155,9 @@ Code navigation
1 Motions 1 Motions
^^^^^^^^^ ^^^^^^^^^
Let's check out `:help object-motions` to get further movements. Let's check out ``:help object-motions`` to get further movements.
TASK: `vim lorem-ipsum.php` and navigate to the 2nd method via `]]` TASK: ``vim lorem-ipsum.php`` and navigate to the 2nd method via ``]]``
2 Plugins 2 Plugins
^^^^^^^^^ ^^^^^^^^^
@ -166,18 +166,18 @@ There are a bunch of plugins and even some plugin manager to choose from.
To navigate within Code I use CTRLP and Tagbar in combination with Universal Ctags. To navigate within Code I use CTRLP and Tagbar in combination with Universal Ctags.
* TASK: Check out the benefits, run `nvim lorem-ipsum.php` and type in `,r`. * TASK: Check out the benefits, run ``nvim lorem-ipsum.php`` and type in ``,r``.
* TASK: Check out the benefits, run `nvim lorem-ipsum.php` and type in `,b`. * TASK: Check out the benefits, run ``nvim lorem-ipsum.php`` and type in ``,b``.
3 Go to definition 3 Go to definition
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
Vim provides support for tags out of the box. Using `CTRL+]` we can jump to the Vim provides support for tags out of the box. Using ``CTRL+]`` we can jump to the
definition of something. definition of something.
TASK: Run `vim lorem-ipsum2.php` to to the constructor and run `CTRL+]` on TASK: Run ``vim lorem-ipsum2.php`` to to the constructor and run ``CTRL+]`` on
`LoremUpsum` type hint. ``LoremUpsum`` type hint.
Efficient editing Efficient editing
----------------- -----------------
@ -186,15 +186,15 @@ We now know some basics to move within source code. What about editing?
Let's change the content of an PHP if condition to just false. Let's change the content of an PHP if condition to just false.
TASK: Change content of if condition within `lorem-ipsum.php` within the `getSum` TASK: Change content of if condition within ``lorem-ipsum.php`` within the ``getSum``
method. method.
Vim provides operators within the `NORMAL` mode. These can be copy, delete, change, Vim provides operators within the ``NORMAL`` mode. These can be copy, delete, change,
uppercase. In our case we want to change the condition = `c`. Following Vim Grammar, uppercase. In our case we want to change the condition = ``c``. Following Vim Grammar,
this can be combined with either a count as prefix, or a motion as suffix. this can be combined with either a count as prefix, or a motion as suffix.
In our case we want to change text within `()` as this is the condition in PHP. We In our case we want to change text within ``()`` as this is the condition in PHP. We
can achieve this by typing `ci(` within the braces. can achieve this by typing ``ci(`` within the braces.
Editing remote files Editing remote files
-------------------- --------------------
@ -300,7 +300,7 @@ what kind of settings do we have, what can we achieve with settings?
Syntax highlighting Syntax highlighting
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
E.g. add the following to highlight hearts in red: E.g. add the following to highlight hearts in red::
hi ERROR ctermfg=9 hi ERROR ctermfg=9
match ERROR /♥/ match ERROR /♥/