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

Re: How to let gvim start on 2nd monitor

Expand Messages
  • David Fishburn
    ... I just wrote a simple mapping to do what I needed and put it in my .vimrc: if has( gui_running ) Reposition gvim when using the windows extended monitor
    Message 1 of 7 , Feb 1, 2013
    • 0 Attachment



      On Fri, Feb 1, 2013 at 8:53 AM, Jeri Raye <jeri.raye@...> wrote:
      Reid

      [...]
      >> I'm using windows 7 on a laptop with a secondairy monitor which I
      >> prefer to use for coding.
      [...]
      Is there something similar in windows 7?

      I just wrote a simple mapping to do what I needed and put it in my .vimrc:
       
      if has("gui_running")
          " Reposition gvim when using the windows extended monitor
          " Top and bottom

          nnoremap <Leader>fx <C-O>:exec 'winpos '.(getwinposx()<0 ? '15' : '15').' '.(getwinposy()<0 ? '17' : '-1192')<CR>
          " This version will change the font size (since it is bigger) and move the screen.
          " Had to record the X and Y positions since set guifont= will cause the
          " screen to move under certain cirumstances.
          nnoremap <Leader>fx :let winx = getwinposx()<CR> \| :let winy = getwinposy()<CR> \| :exec 'set guifont=Bitstream_Vera_Sans_Mono:h'.(winy<0 ? '11' : '11').':b:cANSI'<CR> :echomsg 'executing winpos '.(winx<0 ? '15' : '15').' '.(winy<0 ? '17' : '-1192')<CR> \| :exec 'winpos '.(winx<0 ? '15' : '15').' '.(winy<0 ? '17' : '-1192')<CR>
          " Left and right monitors
          " nnoremap <Leader>fx :exec 'winpos '.(getwinposx()<1900 ? '2055' : '276').' 14'<CR>
          " nnoremap <Leader>fx <C-O>:exec 'winpos '.(getwinposx()<1900 ? '2055' : '276').' 14'<CR>
      endif


      Now, I used -1192, since in my latest desk configuration my extended monitor is "above" my laptop.  So, these are negative values.

      But the easiest thing to do is simply start Vim.  Move Vim where you want it and then run this:
      :echo getwinposx() getwinposy()

      HTH,
      David


      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    Your message has been successfully submitted and would be delivered to recipients shortly.