diff --git a/_posts/2020-03-02-nut-and-ups.md b/_posts/2021-04-09-nut-and-ups.md similarity index 100% rename from _posts/2020-03-02-nut-and-ups.md rename to _posts/2021-04-09-nut-and-ups.md diff --git a/_posts/2021-04-11-VIM-cheat-sheet.md b/_posts/2021-04-11-VIM-cheat-sheet.md new file mode 100755 index 0000000..23ffe21 --- /dev/null +++ b/_posts/2021-04-11-VIM-cheat-sheet.md @@ -0,0 +1,83 @@ +--- +layout: post +title: vim cheat sheet +date: 2021-04-09 17:30:00 +tags: untagged +author: neko +--- + +# Preface + +I've been using vim for a long while now, working on the terminal as much as I do. Over the years, I slowly started using more and more actual features of vim, instead of just having it work for me as a complex to deal with text editor. Last year, I finally set up a personal `dotfile`-repository. Yes, I guess I am one of *those* guys now. + +Anyway, so I've been getting more used to using vim as an in-place IDE instead of running vim solely to edit one document and closing it again. And once you start working with panes in vim, a lot of keyboard shortcuts come into play. I've spend some time aggregating the ones I keep forgetting in a short list, once again, copied verbatim from my internal wiki. + +If you got any tips for me surrounding the usage of vim, or would like me to append some shortcuts that weren't mentioned, shoot me a message! + +# Vim Cheatsheet + +## Commands + +| Command | Description | +| ------------- | ----------- | +| `:e filename` | Edit a file | + +## Buffers + +| Command | Description | +| ------------------- | ---------------------------------------------- | +| `:new` | Open an empty buffer | +| `:b` | Next buffer | +| `:b N` | Select buffer N | +| `:bp` | Previous buffer | +| `:buffers` or `:ls` | List buffers | +| `:split` | Split the current window into horizontal panes | +| `:vsplit` | Split the current window into vertical panes | + +## Tabs + +| Command | Description | +| ---------- | ---------------------- | +| `:tab new` | Create new tab | +| `:tabn` | Switch to next tab | +| `:tabp` | Switch to previous tab | +| `:tabs` | List tabs | + +## Editing + +| Command | Description | +| --------------------- | ----------------------------------- | +| `^v` | Block selection mode | +| `^v (select) I` | Multiline insert (`esc` to confirm) | +| `V` | Line selection mode | +| `>>`or `<<` | Change indentation of current line | +| `>N>` or `` | Switch to pane in direction | +| `^w r` | Rotate windows down/right | +| `^w R` | Rotate windows up/left | +| `^w L` | Move current window to the far right| +| `^w H` | Move current window to the far left| +| `^w J` | Move current window to the very bottom| +| `^w K` | Move current window to the very top| +| `:res N` | Resize pane to N lines | +| `:res +/-N` | Increase/decrease pane size by N | +| `:hide` | Hide current window | +| `:only` | Hide all windows except current |