Charlie Harvey

Vim tip — Preview webpage source

Here's a neat little trick for people who have a *nix setup, vim and lynx browser. I’ve remapped my F8 Key to use lynx to dump the nicely formatted source of a web page in a new window. Useful for testing if your site is working. In my .vimrc I added the following lines:

" split at the bottom of the screen
set sb
" map F9 to open the new window, and type the lynx command for you
noremap <F8> :10sp /dev/null<CR>:r! lynx -prettysrc -source http://
" well, you have to be able to refresh!
noremap <F5> :%s/.//<CR>:r! lynx -pretty<UP><CR>gg0"


Comments

  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.