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 ++++++++++++++++++++++++++++++++++++++++++++++++ Common/vimrc | 16 ++++++++++ Common/zshrc | 1 + install/install_linux.sh | 2 +- install/install_mac.sh | 2 +- 5 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 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 diff --git a/Common/vimrc b/Common/vimrc index ae5457a..f35bafe 100644 --- a/Common/vimrc +++ b/Common/vimrc @@ -125,6 +125,9 @@ endif " Add a bit extra margin to the left set foldcolumn=1 +" Show leader commands +set showcmd + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Colors and Fonts """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -504,3 +507,16 @@ nmap rn (coc-rename) xmap f (coc-format-selected) nmap f (coc-format-selected) + +" vim-multiple-cursors +let g:multi_cursor_use_default_mapping=0 + +" Default mapping +let g:multi_cursor_start_word_key = '' +let g:multi_cursor_select_all_word_key = '' +let g:multi_cursor_start_key = 'g' +let g:multi_cursor_select_all_key = 'g' +let g:multi_cursor_next_key = '' +let g:multi_cursor_prev_key = '' +let g:multi_cursor_skip_key = '' +let g:multi_cursor_quit_key = '' diff --git a/Common/zshrc b/Common/zshrc index 7f8b902..44fbfe4 100644 --- a/Common/zshrc +++ b/Common/zshrc @@ -66,6 +66,7 @@ case "$OSTYPE" in path+=("$(readlink /Users/$DEFAULT_USER/bin)") path+=("/Library/TeX/texbin") path+=("/usr/local/share/dotnet") + path+=("/usr/local/sbin") export PATH alias krak='/Applications/GitKraken.app/Contents/MacOS/GitKraken -p "$(PWD)" &>> /dev/null &' diff --git a/install/install_linux.sh b/install/install_linux.sh index 7355bdd..9c66d62 100755 --- a/install/install_linux.sh +++ b/install/install_linux.sh @@ -25,7 +25,7 @@ function dlgYN() { dlgYN "> Install \"Highlight, atool, w3m, mediainfo, vim, git\"" res if [ $res -eq 1 ]; then tput sc - $INST_PM highlight atool w3m mediainfo curl zsh vim git python3-pip zsh tmux + $INST_PM highlight atool w3m mediainfo curl zsh vim git python3-pip zsh tmux nodejs tput rc; tput ed fi diff --git a/install/install_mac.sh b/install/install_mac.sh index 05a88b3..9b1af7b 100755 --- a/install/install_mac.sh +++ b/install/install_mac.sh @@ -32,7 +32,7 @@ fi dlgYN "> Install \"Highlight, atool, w3m, mediainfo, vim\"" res if [ $res -eq 1 ]; then tput sc - brew install highlight atool w3m mediainfo vim + brew install highlight atool w3m mediainfo vim nodejs tput rc; tput ed fi -- cgit v1.2.3