0

I have the following function:

fu! EditFileInBrowser()
  let l:url = @+
  let l:url = substitute(l:url, 'http:\/\/127\.0\.0\.1:4000\/', '', '')
  let l:url = substitute(l:url, '/$', '', 'g')
  let l:url = substitute(l:url, '-', ' ', 'g')
  let l:file = '~/vimwiki/webnotes/' . l:url . '.md'
  echom l:file
  edit l:file
endfu

It keeps trying to edit the string l:file. I want to edit the value of the variable l:file, of course.

1

2 Answers 2

1

Is there another way to do this, though?

edit `=l:file`

See also :h `=

1

Figures tha after 20 min. of looking for an answer I find it 1 min after posting this:

execute "edit " . l:file

Is there another way to do this, though? Seems weird.

Not the answer you're looking for? Browse other questions tagged or ask your own question.