Whenever I’m mocking up a sample web page, I inevitably end up doing something like this; Create a line; <li id="1">This is item 1</li> Copy it a bunch of times; <li id="1">This is item 1</li> <li id="1">This is item 1</li> <li id="1">This is item 1</li> <li id="1">This is item 1</li> <li id="1">This is item 1</li> … Continue reading Vim – Incrementing a column of numbers
Keeping secrets with Vim encryption
The other day, I discovered that vim has an “encryption” mode. In this mode, your file is encrypted whenever it is written to disk, and decrypted whenever it’s read back (this also applies to any temporary swap files). I used to use the gnupg plugin for this, but it’s pretty tedious to have to type a long … Continue reading Keeping secrets with Vim encryption
Vim: Insert debug statements according to filetype
I’ve got a little keybinding in my .vimrc file which inserts a debug statement into a file, and then saves it; map <Leader>db Odebugger; 1<CR><ESC>:w<CR> So, if I’m editing foo.rb with my cursor on line 2; 1 def hello 2 puts "Hello, world!" 3 end Then if I hit ,db the file will look like this; 1 def hello 2 debugger; … Continue reading Vim: Insert debug statements according to filetype
Logfile spelunking with vim, bash & sed
Today I got an alert from my monitoring system about a possible rootkit on one of my servers (false alarm, thanks for asking). The first thing to do was to look for more details in the rootkit checker logfile. Unfortunately, it’s not very informative; ... [06:55:03] Scanning for string /usr/src/.puta [ OK ] [06:55:03] Scanning … Continue reading Logfile spelunking with vim, bash & sed
RSpec3 + Vim Quickfix List
I’ve got vim nicely set up to run my specs in another tmux pane with a few keybindings, using vim-rspec and tslime. This works really well, but it’s even better if I can use the vim quickfix list to jump to each failing spec with a single keypress. I had a setup to do that … Continue reading RSpec3 + Vim Quickfix List
Vim + clipboard
For years, I’ve been copying text from console Vim running inside tmux running inside iTerm2 by doing this; Ctrl-a + Z - Zoom the current tmux pane to be full screen (if it wasn’t already)Hold down Alt and drag the mouse over the text I want to copy to the clipboardCtrl-a + Z - Unzoom … Continue reading Vim + clipboard