make a writing category
This commit is contained in:
16
writing/vim.md
Normal file
16
writing/vim.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "vim basics"
|
||||
tags: [ "vim", "basic" ]
|
||||
---
|
||||
|
||||
1. Insert text by pressing `i`.
|
||||
1. Stop inserting text by pressing `Ctrl+[`.
|
||||
1. Exit with `ZZ`.
|
||||
1. Congratulations, you now know `vim`.
|
||||
|
||||
## Extras
|
||||
|
||||
- [Navigation](navigate.md)
|
||||
- [Completion](vim-completion.md)
|
||||
- [Search](vim-search.md)
|
||||
- [Window Splits](vim-windows.md)
|
16
writing/vim/completion.md
Normal file
16
writing/vim/completion.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "vim completion"
|
||||
tags: [ "vim", "completion" ]
|
||||
---
|
||||
|
||||
Complete the word by searching for the *n*ext similar word:
|
||||
|
||||
`C-n`
|
||||
|
||||
Complete the word by searching for a *p*revious similar word:
|
||||
|
||||
`C-p`
|
||||
|
||||
Complete the full line:
|
||||
|
||||
`C-x C-l`
|
35
writing/vim/navigate.md
Normal file
35
writing/vim/navigate.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "vim navigation"
|
||||
tags: [ "vim", "navigation" ]
|
||||
---
|
||||
|
||||
| Move | Command |
|
||||
|:------------------------|:-------------|
|
||||
| Down page | Ctl-f |
|
||||
| Down half page | Ctl-d |
|
||||
| Up page | Ctl-b |
|
||||
| Up half page | Ctl-u |
|
||||
| Scroll down | Ctl-e |
|
||||
| Scroll up | Ctl-y |
|
||||
| Jump to previous place | Ctl-i |
|
||||
| Jump to back | Ctl-o |
|
||||
| Jump to last change | g; |
|
||||
| Jump to next change | g, |
|
||||
| Go to current filename | gf |
|
||||
|
||||
Go to a filename, and type `gf` (Go-to-File).
|
||||
For example, if you put your cursor over the `~/.vimrc` in this line, you can edit your vim configuration file.
|
||||
|
||||
`source ~/.vimrc`
|
||||
|
||||
# Project Structure
|
||||
|
||||
Make a 20 character 'visual split' in the current working directory ('`.`').
|
||||
|
||||
`:20vs .`
|
||||
|
||||
Swap buffer positions:
|
||||
|
||||
`C-w x`
|
||||
|
||||
|
22
writing/vim/search.md
Normal file
22
writing/vim/search.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "vim search"
|
||||
tags: [ "vim", "search" ]
|
||||
---
|
||||
Search for the next and or previous occurrence of the word under your cursor with `*` and `#`.
|
||||
|
||||
Search and replace the first 'one' found with 'two':
|
||||
|
||||
`:%s/one/two/`
|
||||
|
||||
Same, but replace 'one' globally:
|
||||
|
||||
`:%s/one/two/g`
|
||||
|
||||
Put quotes around every occurrence of `$HOME`:
|
||||
|
||||
`:%s/$HOME/"&"`
|
||||
|
||||
Same, but add curly brackets around `$HOSTNAME`:
|
||||
|
||||
`:%s/$HOSTNAME/{&}`
|
||||
|
19
writing/vim/vim_in_bash.md
Normal file
19
writing/vim/vim_in_bash.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: "vim in bash"
|
||||
tags: [ "vim", "bash", "inputrc" ]
|
||||
---
|
||||
|
||||
Put bash in vim mode!
|
||||
|
||||
Place the following in your `~/.inputrc`:
|
||||
|
||||
```
|
||||
set editing-mode vi
|
||||
set show-mode-in-prompt on
|
||||
set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2
|
||||
set vi-cmd-mode-string \1\e[33;1m\2[?]=\1\e[0m\2
|
||||
|
||||
set keymap vi-insert
|
||||
RETURN: "\e\n"
|
||||
```
|
||||
|
14
writing/vim/windows.md
Normal file
14
writing/vim/windows.md
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: "vim windows"
|
||||
tags: [ "vim" ]
|
||||
---
|
||||
|
||||
| Command | Keys |
|
||||
|:--------------------------|:-------------------:|
|
||||
| split window | `C-w s` |
|
||||
| split window vertically | `C-w v` |
|
||||
| close window | `C-q` |
|
||||
| change window | `C-w w` |
|
||||
| rotate windows | `C-w r` |
|
||||
| split open new file | `:sf $filepath` |
|
||||
|
10
writing/vim_tricks.md
Normal file
10
writing/vim_tricks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Vim Tricks"
|
||||
tags: [ "vim" ]
|
||||
requiered: [ "ssh" ]
|
||||
---
|
||||
|
||||
## Remote Editing
|
||||
|
||||
`vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*`
|
||||
|
Reference in New Issue
Block a user