From a52da18d18a51774e8c949e2002023212a9c6e75 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Tue, 9 Mar 2021 16:29:58 +0100 Subject: Tweak vim a bit --- Cheatsheet.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Cheatsheet.md (limited to 'Cheatsheet.md') diff --git a/Cheatsheet.md b/Cheatsheet.md new file mode 100644 index 0000000..ec9c8c0 --- /dev/null +++ b/Cheatsheet.md @@ -0,0 +1,78 @@ +# Cheatsheet +Cheatsheets for different terminal things. + +## Vim + +### General vim + +https://vim.rtorr.com + +### [jakobst1n's](https://github.com/jakobst1n/dotfiles) additional keymaps +- Leader key: `,` +- Fast save (`:w!`): `w` +- `:W` -> `sudo save` + +#### Search +- Visual mode `*` or `#` searches for current selection +- Space: `/` (search) +- C-space: `?` (backward search) + +#### Windows +- `` move between windows + +#### Buffers +- `bd` Close current buffer. +- `ba` Close all buffers +- `l` next buffer +- `h` prev buffer + +#### tabs +- `tn` new tab +- `to` tabonly +- `tc` close tab +- `tm` move tab +- `t` next tab +- `tl` Last used tab +- `te` Open new tab with current buffers path. + +#### Working directory +- `cd` Set working directory to path of current buffer + +#### Line moving +You can move a line of text using `ALT+[jk]` or `CMD+[jk]` on mac. + +#### Spell checking +- `ss` Toggle spellcheck +- `sn` `]s` +- `sp` `[s` +- `sa` `zg` +- `s?` `z=` + +#### Clipboard +- `pp` Toggle paste mode + +#### NerdTree +- `` To toggle + +#### FuzzyFinder +- `;` To open + +#### CoC +- Use `` for autocomplete +- `gd` Go to definition +- `gy` Go to type definition +- `gi` Go to implementation +- `gr` Go to references +- `K` To show documentation in preview window +- `rn` Rename symbol +- `f` format selected + +#### Multiple-cursors +- ``->`start_word_key` +- ``->`select_all_word_key` +- `g`->`start_key` +- `g`->`select_all_key` +- ``->`next_key` +- ``->`prev_key` +- ``->`skip_key` +- ``->`quit_key` \ No newline at end of file -- cgit v1.2.3 From f8c26c933396271813b669bd74e5eff5e67426ab Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Wed, 10 Mar 2021 07:54:50 +0100 Subject: Add some tmux tips --- Cheatsheet.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) (limited to 'Cheatsheet.md') diff --git a/Cheatsheet.md b/Cheatsheet.md index ec9c8c0..7412f94 100644 --- a/Cheatsheet.md +++ b/Cheatsheet.md @@ -75,4 +75,92 @@ You can move a line of text using `ALT+[jk]` or `CMD+[jk]` on mac. - ``->`next_key` - ``->`prev_key` - ``->`skip_key` -- ``->`quit_key` \ No newline at end of file +- ``->`quit_key` + + + +## Tmux + +### General Tmux +- Prefix `Ctrl`+`a` + +#### Sessions +- `tmux`, `tmux new`, `tmux new-session`, `:new` new session. +- `tmux new -s `, `:new -s ` new session with name. +- `tmux kill-ses -t `, `tmux kill-session -t ` kill delete session with name. +- `tmux kill-session -a` kill/delete all sessions but the current. +- `tmux kill-session -a -t ` kill/delete all sessions but the named one. +- `prefix` `$` rename session. +- `prefix` `$`Detach from session. +- `:attach -d`Detach others on the session (Maximise window by detach other clients). +- `tmux ls`, `tmux list-sessions`, `prefix` `s` show all sessions. +- `tmux a`, `tmux at`, `tmux attach`, `tmux attach-session` attach to last session. +- `tmux a -t `, `tmux at -t `, `tmux attach -t `, `tmux attach-session -t ` attach to a session with name. +- `prefix` `(` Move to previous session. +- `prefix` `)` Move to next session. + +#### Windows + +- `prefix` `c` Create window. +- `prefix` `,` Rename window. +- `prefix` `&` Close current window. +- `prefix` `p` Previous window. +- `prefix` `n` Next window. +- `prefix` `0`..`9` Switch/select window by number. +- `:swap-window -s 2 -t 1` Reorder window, swap window number 2(src) and 1(dst). +- `:swap-window -t -1` Move current window to the left by one position. + +#### Panes + +- `prefix` `;` Toggle last active pane. +- `prefix` `%` Split pane vertically. +- `prefix` `"` Split pane horizontally. +- `prefix` `{` Move the current pane left. +- `prefix` `}` Move the current pane right. +- `prefix` `up/down/right/left` swith to pane in direction. +- `:setw synchronize-panes` Toggle synchronized-panes. +- `prefix` `Space` Toggle between pane layouts. +- `prefix` `o` Switch to next pane. +- `prefix` `q` Show pane numbers. +- `prefix` `q` `0`..`9` Switch/select pane by number. +- `prefix` `z` Toggle pane zoom. +- `prefix` `!` Convert pane into a window. +- `prefix`+`arrow`, `prefix` `ctrl`+`arrow` resize current pane in direction. +- `prefix` `x` Close current pane. + +#### Copy Mode + +- `:setw -g mode-keys vi` use vi keys in buffer. +- `prefix` `[]` enter copy mode. +- `prefix` `PgUp` enter copy mode and scroll one page up. +- `q` Quit mode. +- `g` Go to top line. +- `G` Go to bottom line. +- `Up` Scroll up. +- `Down` Scroll down. +- `h/j/k/l` Move cursor. +- `w/b` Move cursor one word forward/back. +- `/`/`?` Search forward/backward. +- `n` next keyword occurrence. +- `N` Previous. occurrence. +- `Space` Start selection. +- `ESC` Clear selection. +- `Enter` Copy selection. +- `prefix` `]` Paste contents of buffer_0. +- `:show-buffer` Display buffer_0 contents. +- `:capture-pane` Copy entire visible contents of pane to a buffer. +- `:list-buffers` Show all buffers. +- `:choose-buffer` Show all buffers and paste selected. +- `:save-buffer ` Save buffer contents to file. +- `:delete-buffer -b 1` Delete buffer 1. + +#### Misc + +- `prefix` `:` Enter command mode. +- `:set -g OPTION` Set OPTION for all sessions. +- `:setw -g OPTION` Set OPTION for all windows. + +#### Help + +- `tmux info` Show every session, window, pane, etc... +- `prefix` `?` Show shortcuts. \ No newline at end of file -- cgit v1.2.3 From bcfdcd2a5ce45fb81bbf39fdae1a8f1a47d1b4de Mon Sep 17 00:00:00 2001 From: Jakob Stendahl <14180120+JakobST1n@users.noreply.github.com> Date: Wed, 10 Mar 2021 11:26:16 +0100 Subject: Add NerdCommenter --- Cheatsheet.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Cheatsheet.md') diff --git a/Cheatsheet.md b/Cheatsheet.md index 7412f94..ae2cec1 100644 --- a/Cheatsheet.md +++ b/Cheatsheet.md @@ -77,6 +77,20 @@ You can move a line of text using `ALT+[jk]` or `CMD+[jk]` on mac. - ``->`skip_key` - ``->`quit_key` +#### NerdCommenter +- `cc` Comment out current line or lines in visual mode. +- `cn` Same as cc but forces nesting. +- `c` Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa. +- `cm` Comments the given lines using only one set of multipart delimiters. +- `ci` Toggles the comment state of the selected line(s) individually. +- `cs` Comments out the selected lines with a pretty block formatted layout. +- `cy` Same as cc except that the commented line(s) are yanked first. +- `c$` Comments the current line from the cursor to the end of line. +- `cA` Adds comment delimiters to the end of line and goes into insert mode between them. +- `ca` Switches to the alternative set of delimiters. +- `cu` Uncomments the selected line(s). + + ## Tmux @@ -163,4 +177,4 @@ You can move a line of text using `ALT+[jk]` or `CMD+[jk]` on mac. #### Help - `tmux info` Show every session, window, pane, etc... -- `prefix` `?` Show shortcuts. \ No newline at end of file +- `prefix` `?` Show shortcuts. -- cgit v1.2.3