Loading ...
Sorry, an error occurred while loading the content.

Re: Setting of visual mode marks for put text

Expand Messages
  • Jens Paulus
    Hi Keith, ... here is how I did it. vn d d:let gvtest= vn D D:let gvtest= no p :exe norm! p call Gv() no gp :exe norm!
    Message 1 of 6 , Dec 4, 2004
      Hi Keith,

      On Fri, Dec 03, 2004 at 14:08:43 -0800, Keith Roberts wrote:
      > You could create a command, something like:
      > command GV call GV()
      > And the function GV(), which would do something like:
      > - use visualmode() to figure out the type of selection
      > - col('.') and line('.') will show if current selection is empty
      > - if not empty, :normal gv
      > - if empty, :normal `[{v|V|CTRL-V}`]

      here is how I did it.

      vn <silent> d d:let gvtest=""<CR>
      vn <silent> D D:let gvtest=""<CR>
      no p :exe "norm! p"<bar>call Gv()<CR>
      no gp :exe "norm! gp"<bar>call Gv()<CR>
      no p] :exe "norm! p]"<bar>call Gv()<CR>
      no P :exe "norm! P"<bar>call Gv()<CR>
      no gP :exe "norm! gP"<bar>call Gv()<CR>
      no [p :exe "norm! [p"<bar>call Gv()<CR>
      fun Gv()
      if exists("g:gvtest")
      exe "norm mp`[".visualmode()."`]\<C-\>\<C-N>`p"
      unl g:gvtest

      This works well. One mark is used to store the cursor position after the
      put cmmmand. The cursor position within the visual area is not stored.

      Best regards

    Your message has been successfully submitted and would be delivered to recipients shortly.