diff --git a/blog/2024/vim-manifesto/.blogignore b/blog/2024/vim-manifesto/.blogignore new file mode 100644 index 0000000..e69de29 diff --git a/blog/2024/vim-manifesto/content.md b/blog/2024/vim-manifesto/content.md new file mode 100644 index 0000000..be3934b --- /dev/null +++ b/blog/2024/vim-manifesto/content.md @@ -0,0 +1,52 @@ +## Introduction + +The modal editor's fall into obscurity is truly one of the greatest losses in the history of computing. + +There's no denying that point-and-click is _easy_, and sure, it's enough for the majority of people using +their computer as a minor tool. + +But for those who use a text editor as their natural habitat, there's no reason why text editors should stop at +pointing the mouse where you want to go and typing. This leads to the typical editing session consisting of: + +- Scroll around with mouse +- Locate the location where you want to add text +- Move mouse to location, click it +- Finally, move back to the keyboard and make your edit + +Then, switch back to your mouse and repeat. + +Of course, there are ways in which users seek to streamline this process. Almost everyone who edits text +daily knows at least a few keyboard shortcuts to quickly jump around words and in between lines to move to nearby +points of interest quickly without switching back to the mouse. Other more dedicated power users might learn a slew of +modifier-key based commands to quickly navigate around, removing the need for a mouse entirely when editing within +a file. + +All of these, however, are halfway solutions. Namely, they generally utilize a modifier based approach. Hold `ctrl` +(or `option`, on macOS) and use the arrow keys to navigate quickly. Hold `ctrl` and hit `delete` to delete entire words at once. +Hold `shift` to highlight text. `ctrl + c` copies, `ctrl + v` pastes, `ctrl + x` cuts. You get the idea. + +A pseudo- medical condition has even been coined for this reliance on modifier keys: the dreaded Emacs pinky, where +users of emacs, which relies heavily on `ctrl`, `meta`, and other modifier based shortcuts, experience RSI due to their +frequent usage of their pinky to stretch down to those keys. + +This method of designing and organizing the text editor is wrong. _Moving around text_ (and files) is just as, if not +more prevalent than inserting text itself. So why treat navigation as an afterthought? Why should you _edit by default_, +and hold a modifier key to temporarily enable a different control scheme which handles locomotion? This is where the +genius of the modal editor comes in. + +## Vim + +In Vim, the editor itself is split into three main "modes", hence the classification of "modal". Instead of treating +navigation as an afterthought, Vim opens in its "normal mode", which provides the user with many keys to move around their +text file: `hjkl` as arrow keys, `b`, `e`, and `w`, to navigate around words, `0`, `$`, and `_` to jump around lines, `{`, `}`, +`z`, and more, for quickly repositioning your cursor and screen vertically. Notice how all of these keys are easily accessible +from the home row. Just as importantly, notice how there's no need for you to hold any modifiers to access these actions. +These keys don't input text in normal mode; they simply handle navigation. Many point-and-click acolytes believe this to be +a failure. "Why wouldn't you want your editor to _edit_ by default?" Of course, this is not a failure, but one of its +greatest strengths. How many times do you open a file and immediately need to start editing? Almost always, you need to first +navigate to a specific location, usually move or change some text, and then begin editing. In Vim, this is streamlined by +default. You can navigate the entire file using just commands found near the home row, without needing to use a mouse or +hit complicated chords. Instead of treating navigation as an afterthought for power-users, it treats it as a primary +feature of the editor itself. + +Written on Neovim. diff --git a/blog/2024/vim-manifesto/post.toml b/blog/2024/vim-manifesto/post.toml new file mode 100644 index 0000000..65227b0 --- /dev/null +++ b/blog/2024/vim-manifesto/post.toml @@ -0,0 +1,20 @@ + +#:schema ../../../post.schema.json +title = "The Vim Manifesto" + +[manifest] +date = 2024-04-23T07:49:52+00:00 +authors = ["Youwen Wu"] +blurb = "Glory to the one true text editor." +description = "The loss of the modal editor is truly one of the greatest tragedies in the history of computing. Vim is the last bastion of hope in a world of point-and-click." +type = "article" +highlight = true + +[manifest.tags] +primary = ["vim", "neovim", "text editor", "ide"] +secondary = [] + +[cover] +src = "https://raw.githubusercontent.com/Aikoyori/ProgrammingVTuberLogos/main/Neovim/NeovimShadowed.png" +alt = "neovim vtuber style logo" +caption = "The One True Text Editor" diff --git a/src/globals.d.ts b/src/globals.d.ts index bb8b530..8cebc8f 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -7,7 +7,7 @@ interface BlogDocument { blurb: string; image: { src: string; alt: string; caption: string }; description: string; - slug; + slug: string; } declare module 'remark-sectionize'; diff --git a/src/lib/components/Blog/PostMetadata.svelte b/src/lib/components/Blog/PostMetadata.svelte index 92f3f8b..986e3e1 100644 --- a/src/lib/components/Blog/PostMetadata.svelte +++ b/src/lib/components/Blog/PostMetadata.svelte @@ -20,7 +20,6 @@ import Badge from '../ui/badge/badge.svelte'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; - import { onMount } from 'svelte'; dayjs.extend(relativeTime); diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index a587da4..925566e 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -3,7 +3,7 @@ import Button from '$lib/components/ui/button/button.svelte'; import { Home } from 'svelte-radix'; - const error = $page.error ?? { message: 'unknown' }; + const error = $page.error ?? { message: 'unknown' };