ex

Vim: Call an ex command (set) from function?

Drawing a blank on this, and google was not helpful. Want to make a function like this: function JakPaste() let tmp = :set paste? if tmp == "paste" set nopaste else set paste endif endfunction map <F2> :call JakPaste()<CR> However this does not work. I have isolated t...

Getting text that is on a different line, with ex in Vim

Let's say I have the following text in Vim: file1.txt file2.txt file3.txt renamed1.txt renamed2.txt renamed3.txt I want a transformation as follows: file1.txt renamed1.txt file2.txt renamed2.txt file3.txt renamed3.txt What I have in mind is something like the following: :1,3 s/$/ <the text that is 4 lines below this line> I'm...

Vim ex knowing number typed before

I'm making a shortcut that places a # at the front of each line, in the next x lines. x is a number I type before entering the shortcut, like typing 11dd deletes the next eleven lines. The command is .,+10 s/^/#/g. Here the number ten should really be whatever was typed before the shortcut. How do I make the shortcut change according to...

using encodeURI to display an entire page

Hi I am making a chrome extension. Where I save a page to the database as a string and then open it later as a dataURI scheme like: d = 'data:text/html;charset=utf-8'+encodeURI('HTML TEXT') location.reload(d); The problem with this is that the page, say its name is http://X/, in which I executed the above command loses the javascript ...