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

Re: How to use mode() ?

Expand Messages
  • Christian Ebert
    * Bob Hiestand on Tuesday, November 29, 2005 at 16:54:08 -0600: Depending, of course, on how you wish to use that information, you might be interested in:
    Message 1 of 7 , Nov 30, 2005
      * Bob Hiestand on Tuesday, November 29, 2005 at 16:54:08 -0600:
      > Depending, of course, on how you wish to use that information, you
      > might be interested in:
      >
      > :help i_ctrl-r

      Actually I /can/ use the info because I had a script to paste the
      contents of the current screen buffer in mind, and the following
      seems to work:

      #v+
      " Paste screen buffer
      if &term == "screen"
      fun ScreenPaste()
      let s:curr_mode = mode()
      set paste
      if s:curr_mode == "n"
      star
      endif
      " use ctrl-chars for esc and return
      call system("screen -X paste .; screen -X stuff ':set nopaste '")
      if s:curr_mode == "i"
      return ""
      endif
      endfun
      nnoremap <Leader>p :call ScreenPaste()<CR>
      inoremap <Leader>p <C-R>=ScreenPaste()<CR>
      endif
      #v-

      Thanks.

      c
      --
      __ _ _ _ __ _ _
      \ \ | |__| |__ _ __| |_\ \| |_ _ _ __ _ __| |_
      \ \| '_ \ / _` / _| / /\ \ _| '_/ _` (_-< ' \
      \_\_.__/_\__,_\__|_\_\ \_\__|_| \__,_/__/_||_| http://www.blacktrash.org/
    Your message has been successfully submitted and would be delivered to recipients shortly.