From 2b25b70c29d5b06e757812ee6b7e41e22ad47ec6 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Sat, 3 Feb 2024 22:14:07 +0100 Subject: [PATCH] add gx support --- CHEATSHEET.md | 60 +++++++++++++++++++++--------------- lua/weeheavy/plugins/oil.lua | 3 +- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/CHEATSHEET.md b/CHEATSHEET.md index 3668f04..712910e 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -5,42 +5,24 @@ Some of these are plain Vim commands, others are specific to Neovim. ## BASICS - `Space` leader key -- `:so` Source file -- `:checkhealth` check base and all plugins -- `:checkhealth ` check for problems of a plugin +- `:checkhealth []` check base or status - `:verbose set expandtab?` check where `expandtab` has been set last - -### Lazy - - `:Lazy` show package manager UI - `:Lazy restore` revert plugins to the state reflected in `lazy-lock.json` - -### Mason - - `:Mason` show Mason UI - -### Treesitter - -- `:TSUpdate` update all parsers -- `:TSModuleInfo` show installed parsers - -### LSP - +- `:TSUpdate` update all treesitter parsers +- `:TSModuleInfo` show installed treesitter parsers - `:LspInfo` show currently attached LSP client details - `:ConformInfo` useful to debug why a formatter times out -- `Ctrl`+`n/p` scroll down/up through LSP suggestions -- `Ctrl`+`l` accept selected suggestion -## NAVIGATION +## NAVIGATING ## Tabs -Use buffers in situations where - - `Ctrl`+`t` open a file in e.g. a Telescope finder in a new tab - `gt` or `gT` switch between open tabs (forward/reverse direction) -## Window/split +## Windows/splits - `Ctrl`+`wq` close window - `Ctrl`+`ws` split window **horizontally** @@ -50,7 +32,7 @@ Use buffers in situations where - `Ctrl`+`wr` swap position of two windows - `Ctrl`+`wT` move active split window to new tab -## Buffer +## Buffers - `Space`+`Space` shows buffers sorted by last used (via `Telescope buffers`) - `:bd` close current buffer @@ -62,9 +44,32 @@ Use buffers in situations where - `w` move to **start of next word** (ignores punctuation due to remap) - `e` move to **end of next word** (ignores punctuation due to remap) - `b` move to **start of previous word** (ignores punctuation due to remap) +- `Ctrl`+`0` start of line +- `Ctrl`+`$` end of line - `Ctrl`+`d` scroll **down** 1/2 page while keeping the cursor centered - `Ctrl`+`u` scroll **up** 1/2 page while keeping the cursor centered - `Ctrl`+`o` jump to location you were before (e.g. after using `gg`) +- `Ctrl`+`i` jump back to location you were before (after using `Ctrl`+`o`) +- `f` jump forward to `` +- `F` jump backwards to `` +- `t` jump forward just before `` +- `T` jump backwards just before `` +- `;` jump to next occurence of (same line only) +- `,` jump to previous occurence of (same line only) + +## LSP + +- `Ctrl`+`n/p` scroll down/up through LSP suggestions +- `Ctrl`+`l` accept selected suggestion +- `gd` go to definition + +## Diagnostics + +- `gd` go to definition +- `leader`+`qq` toggle trouble.nvim quickfix list +- `leader`+`da` go to next diagnostic (any severity) +- `leader`+`dw` go to next diagnostic (warning severity) +- `leader`+`de` go to next diagnostic (error severity) ## Telescope windows @@ -76,6 +81,8 @@ Use buffers in situations where - `Ctrl`+`v` open file in **vertical** split - `Ctrl`+`x` open file in **horizontal** split - `Ctrl`+`t` open file in new tab +- `Ctrl`+`q` send all items to quickfix list +- `Alt`+`q` send selected items to quickfix list ## EDITING @@ -104,9 +111,12 @@ Use buffers in situations where - `V` line mode - `Ctrl`+`v` block mode -## SEARCH +## SEARCH/OPEN - `leader`+`fg` search text in files (also searches for text under cursor) - `leader`+`ff` search files (respects `.gitignore`) - `leader`+`e` toggles Oil file explorer - `leader`+`fo` recently opened files +- `gf` open file under cursor in a new buffer +- `gx` open link under cursor in default browser +- `*` search marked word diff --git a/lua/weeheavy/plugins/oil.lua b/lua/weeheavy/plugins/oil.lua index 3c5a18e..9b69e35 100644 --- a/lua/weeheavy/plugins/oil.lua +++ b/lua/weeheavy/plugins/oil.lua @@ -10,7 +10,8 @@ return { config = function() local oil = require("oil") oil.setup({ - default_file_explorer = true, + -- Leave netrw there, so we can open link with `gx` + default_file_explorer = false, columns = { --"size", "icon",