Tuesday, December 2, 2014

Expanding a variable

Trying to get this to work, not sure how.

Vim 7.4.491

Assume the net result is I have this:

let test_newline = '\n'

Note, that is not:
let test_newline = "\n"

As this value is getting assigned from some other place.

What I want to do is be able to convert it back into the equivalent of:
"\n"

I have tried the following:

let test_newline = "\n"
echo expand(test_newline)
echo expand('"'.test_newline.'"')
echo '"'.test_newline.'"'
echo substitute(test_newline, '\\', "\\\\", 'g')
echo eval(test_newline)

Anyone have any ideas?

Thanks,
Dave


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment