Vim Tips Wiki
Tip 555 Printable Monobook Previous Next

created 2003 · complexity intermediate · author Mikolaj Machowski · version 6.0

Sometimes you are collecting bookmarks from various sources, not only web, mail client, usenet even newspapers. Sometimes it is not possible or convenient to insert them in your favorite web browser bookmark manager. But nothing is lost - you can use Vim.

Keep all URLs in one file called, for example, url – one URL per line.

Put this in your vimrc:

autocmd BufRead ~/url map <F8> :call BrowserURL()<CR>
let g:web_browser = "konqueror"
function! BrowserURL()
  if getline('.') !~ '^\s*\#'
    if g:web_browser == "konqueror"
      exe ":!dcop `dcopfind -a 'konqueror*'` konqueror-mainwindow\\#1 newTab ".getline('.')
    elseif g:web_browser == "mozilla"
      exe ":!mozilla -remote \"openurl(".getline('.').", new-tab)\""

Use visual mode to select one or more lines, then press a key to open the URLs in tabs. Any line starting with '#' is a comment and is skipped.

I am sure such operation are possible also with other web browsers with tabs.

Konqueror from KDE3.2-Alpha1 (but this dcop commands should work also with older versions)

Mozilla 1.4