mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-12 06:19:06 +00:00
![Gabriel Arazas](/assets/img/avatar_default.png)
The notes are mainly extracted from the daily fleeting notes which clutter some of the more important thoughts. I figured it would be better to create Dendron-inspired hierarchical notes. Also, some of the notes are updated. I also started to create my visual aids for whatever reason. ;p
133 lines
3.5 KiB
Org Mode
133 lines
3.5 KiB
Org Mode
:PROPERTIES:
|
|
:ID: 9d549240-e7bb-4f6e-95bc-ea131a6a34e7
|
|
:END:
|
|
#+title: Anki: Vim
|
|
#+date: "2021-05-01 17:52:58 +08:00"
|
|
#+date_modified: "2021-05-07 19:31:27 +08:00"
|
|
#+language: en
|
|
#+property: anki_deck Vim
|
|
|
|
* Jump to previous jump point
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619862911606
|
|
:END:
|
|
** Front
|
|
How to get back in previous jump point?
|
|
** Back
|
|
=Ctrl + O=
|
|
|
|
Remember it as getting *out* of the current jump point and back to the previous one.
|
|
|
|
* Enter jump point
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619866523112
|
|
:END:
|
|
** Front
|
|
How to jump into a keyword?
|
|
** Back
|
|
- =Ctrl + ]= will enter into the definition block of a keyword.
|
|
- =K= also has the same effect.
|
|
|
|
* Go to file path
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619866578855
|
|
:END:
|
|
** Front
|
|
How to go to the file path at point?
|
|
** Back
|
|
=gf= (in normal mode) as in *goto file*.
|
|
|
|
* Set as a pager
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619873854130
|
|
:END:
|
|
** Front
|
|
How to set Vim as a manpager?
|
|
** Back
|
|
~MANPAGER="nvim +Man!"~
|
|
~+Man!~ is a command invocation (as if entering ~:Man~ inside Vim).
|
|
It can also be written as ~-c Man!~.
|
|
|
|
The ~:Man!~ command displays the current buffer as a manual page.
|
|
|
|
* Show outline/table of content
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619873854327
|
|
:END:
|
|
** Front
|
|
How to show the table of contents of a document?
|
|
** Back
|
|
=gO=, although the results are filetype-specific (and some don't have any).
|
|
Helpful examples include for manual pages and help pages (from =:help=).
|
|
|
|
* Detect files through filetypes
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1619937647469
|
|
:END:
|
|
** Front
|
|
How does Vim detect the files?
|
|
** Back
|
|
Vim guesses the file by assigning *filetypes*, mainly through the file name and reading the file content.
|
|
A filetype is how Vim knows what plugins to apply to the current buffer.
|
|
|
|
Vim has a few built-in filetypes such as shell, manual pages, Markdown, Asciidoc, xmodmap, patch files, and JSON among others (that are in =$VIMRUNTIME/filetype.vim=).
|
|
|
|
For more information, run ~:help filetype~ inside Vim.
|
|
|
|
* Going to keyword definitions
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1620225232521
|
|
:END:
|
|
** Front
|
|
How to go to the keyword definition?
|
|
** Back
|
|
=gd= as in *go to definition*.
|
|
|
|
Though, not all the time it will do what its supposed to do.
|
|
For better effect, you can generate a Ctags file which Vim has a built-in integration (see ~:h ctags~).
|
|
|
|
* Vim modes
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1620225233076
|
|
:END:
|
|
** Front
|
|
What is a mode (in Vim)?
|
|
** Back
|
|
A Vim mode is a set of behavior and actions.
|
|
In this case, it considers editing and navigation (among other modes) to be separate.
|
|
Thus, you need to switch between them to do those things.
|
|
|
|
Vim has built-in modes which you can see with ~:h vim-modes~.
|
|
|
|
* Word wrapping
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1620387078116
|
|
:END:
|
|
** Front
|
|
How to do word wrapping?
|
|
** Back
|
|
=gw= as in *go format the words*.
|
|
By default, it simply line wraps the lines with the 80-character limitation.
|
|
|
|
* Using the help system
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Styled cards
|
|
:ANKI_NOTE_ID: 1620387086463
|
|
:END:
|
|
** Front
|
|
How to effectively make use of the help system?
|
|
** Back
|
|
The usual way is to execute ~:h~ or ~:help~.
|
|
You can view what does a keybinding do with ~:h ${KEYBINDING}~ — e.g., ~:h gw~ to know what =gw= does, ~:h V~ for viewing visual line mode.
|
|
For keybindings in visual and command line mode, prepend them with ~v_~ and ~c_~, respectively.
|