Breaking my VS Code habit with Vim
Microsoft earned itself the rather descriptive name ‘Microslop’ in recent months, on account of having infested virtually all its products with ‘AI’/Co-Pilot stuff that nobody asked for and few want. It’s especially insidious and invasive enough in Windows 11 that one shouldn’t expect any privacy when using it.
Visual Studio Code was a decent editor that I’d been using since Atom got deprecated. Now it’s primarily an ‘open source AI code editor’, its official Web site declares. I’d disabled a load of ‘AI’/Co-Pilot settings a month ago, only to find even more of that stuff was pushed into it and enabled by default. There are also reports that the Co-Pilot in VS Code is appending its own attributions to GitHub commit messages by default (that’s ‘vibe coding’ for you). Rather than playing cat-and-mouse trying to keep Co-Pilot disabled, and worry about what’s being sent to some LLM data centre in the background, I’ve decided to go back to using Vim and Notepad++ as my editors of choice, especially for the maintainance of this Web site.
Vim is actually a much better editor, because it’s versatile, heavily customisable, extendable and uses only a fraction of system memory that modern editors use. It could be a minimal text editor, or it could be confgured as a fully-featured developer environment. Vim quickly becomes intuitive with a small handful of keybindings and commands for basic usage.
Windows users have the option of the desktop version, gVim. If I remember correctly, it could also be used in PowerShell.
Basic usage
Vim has three modes: Insert, Normal and Command. The names aren’t important, as we can switch between them with just two keys. Press ‘i’ to start editing text. If we want to write the modified text to a file, or quit the editor, just use the ‘Esc’ key, and enter one of the following commands to quit the editor, write to file, or write to file and quit:
:w
:wq
:q!
Commands are always prefixed with ‘:’, after pressing ‘Esc’.
What about cutting, copying and pasting sections of text or code? We can do that by pressing ‘Esc’, then using the ‘v’ key to mark the beginning of the section and using the right arrow key to highlight the rest. After that, ‘d’ to cut, ‘y’ to copy and ‘p’ to paste.
And that’s pretty much all that needs to be remembered for basic editing and saving. I’ll likely follow this up with a repost on how to use some of the more advanced features, such as tabs, windows, autocomplete, folding sections, etc.
Configuration file
There is a configuration file for Vim - typically found at /etc/vim/vimrc. Modifying this is completely optional, but the following are a few lines that might be worth adding.
runtime! debian.vim
" Read config from /etc/vim first
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" Some handy features for coding
set linebreak
set tabstop=4
set ruler
set number
" Encryption algorithm. Not sure whether this is still the
" most secure option for Vim.
set cm=blowfish2
" Write file only when the write command is used
set nobackup
set nowritebackup
" Selected colour theme
color zaibatsu
set background=dark
syntax on
" These are for searches
set ignorecase
set smartcase
highlight Pmenu guibg=black guifg=green
"The following are for the command mode
set cmdheight=2
source $VIMRUNTIME/menu.vim
set wildmenu
set cpo-=<
set wcm=<C-Z>
map <F4> :emenu <C-Z>