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

Re: Set MacVim window position?

Expand Messages
  • björn
    ... I would say you are asking at exactly the right list. :) At this point in time there is no way to affect window placement in MacVim (short of dragging the
    Message 1 of 8 , Aug 8 4:15 AM
    • 0 Attachment

      How do I place the MacVim window? I hate when subsequent windows run
      to hide in the bottom right corner of the screen, I would like the
      window to always appear in the center of the screen. After some
      fiddling I have found the :winpos command, but the documentation says
      it does not work with all implementations and it really seems to have
      no effect on the MacVim window. (I hope that this is the right list to
      ask this question. If not, please let me know.)

      I would say you are asking at exactly the right list. :)

      At this point in time there is no way to affect window placement in MacVim (short of dragging the window with the mouse).  The ':winpos' command is unsupported (and adding support for this is low priority at the moment).

      I have been considering how to deal with this issue; the standard behaviour for multi-window apps is to remember their position (and size) in the user defaults.  This entry is usually stored under the window title but Vim changes the title all the time when editing multiple files.  Also, the title depends on the working directory, so I'm not sure if this approach would work that well.  Maybe the position data could be associated with the filename (with complete path information) in the first tab.  I'm not sure what would work.  Does anybody else have any better ideas?


      /Björn

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---

    • ozzi
      ... How about making it work like Safari 3 (and other versions/apps I m sure) when opening a new window? Any new window is opened with the same geometry as the
      Message 2 of 8 , Aug 27 7:19 AM
      • 0 Attachment
        > Does anybody else have any better ideas?

        How about making it work like Safari 3 (and other versions/apps I'm
        sure) when opening a new window? Any new window is opened with the
        same geometry as the most recently resized window. This is saved
        across restarts as well.

        Of course this would mean individual files wouldn't have their
        position/size remembered, but since a Vim window is more of a
        container for buffers/tabs and not direct representation of a file, I
        think this makes sense.


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • björn
        ... Apart from saving the window size, isn t this how MacVim works already? The window position of the first window opened is stored in the user defaults and
        Message 3 of 8 , Aug 27 9:12 AM
        • 0 Attachment

          > Does anybody else have any better ideas?

          How about making it work like Safari 3 (and other versions/apps I'm
          sure) when opening a new window? Any new window is opened with the
          same geometry as the most recently resized window. This is saved
          across restarts as well.

          Of course this would mean individual files wouldn't have their
          position/size remembered, but since a Vim window is more of a
          container for buffers/tabs and not direct representation of a file, I
          think this makes sense.

          Apart from saving the window size, isn't this how MacVim works already?  The window position of the first window opened is stored in the user defaults and restored when the first window is opened again.  Or did they change something in Safari 3?  (I based the current behaviour on Safari 2).

          Saving the window size brings up the following question: Which settings should be autosaved?  Ok, we can autosave window position and size, fine.  How about the toolbar contents and whether it is hidden or not?  How about all the other gui options (scrollbars, etc.)?  Colorscheme?  Et cetera.  Should MacVim even touch these things, since you can already set these in you .gvimrc?

          I like the idea of autosaving, since this relieves the user of having to know which gvimrc options to set.  Also, it is pretty standard for OS X apps to autosave a lot of information.  My only concern is whether it will offend Vim users to have all this stuff going on "behind the scenes".  I could always make it so that gvimrc settings override the autosaved settings; would that be good?

          To summarize:

          1. Do we want settings to be autosaved, or should the user be forced to edit gvimrc?
          2. Which settings should be autosaved?

          Please let me know what you think.


          /Björn

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---

        • Nico Weber
          ... Add this as an option that can be set in my gvimrc -- this way gvimrc- savvy users can fool around with it and beginners can ignore it for now. Speaking of
          Message 4 of 8 , Aug 27 9:42 AM
          • 0 Attachment
            > 1. Do we want settings to be autosaved, or should the user be
            > forced to edit gvimrc?
            > 2. Which settings should be autosaved?

            Add this as an option that can be set in my gvimrc -- this way gvimrc-
            savvy users can fool around with it and beginners can ignore it for now.

            Speaking of autosaving: Do you see any way to store a "global" vim
            session that can remember how many windows were open? That is,
            something like a command like `:globalsession` that writes a bundle
            containing the number of windows open and a session for each window,
            and doing `:loadglobalsession bla.bundle` would restore all the
            windows in it and `:source` the sessions for it? `:globalsession`
            should also tweak 'sessionoptions` to store window size etc in the
            sessions.

            That'd be totally cool.

            Nico


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • björn
            ... It certainly sounds feasible... However, first I have to come up with a unified way of dealing with autosave information (when/how is it passed to a new
            Message 5 of 8 , Aug 27 10:20 AM
            • 0 Attachment

              > 1. Do we want settings to be autosaved, or should the user be
              > forced to edit gvimrc?
              > 2. Which settings should be autosaved?

              Add this as an option that can be set in my gvimrc -- this way gvimrc-
              savvy users can fool around with it and beginners can ignore it for now.

              Speaking of autosaving: Do you see any way to store a "global" vim
              session that can remember how many windows were open? That is,
              something like a command like `:globalsession` that writes a bundle
              containing the number of windows open and a session for each window,
              and doing `:loadglobalsession bla.bundle` would restore all the
              windows in it and `:source` the sessions for it? `:globalsession`
              should also tweak 'sessionoptions` to store window size etc in the
              sessions.

              It certainly sounds feasible... However, first I have to come up with a unified way of dealing with autosave information (when/how is it passed to a new Vim instance, etc.).  I will note this idea down and see how/if it could work.


              /Björn

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_mac" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---

            • ozzi
              ... My copy of MacVim doesn t work this way. Every window I open is the same, default size. I just downloaded it yesterday, so I think it s the newest version
              Message 6 of 8 , Aug 27 7:00 PM
              • 0 Attachment
                > Apart from saving the window size, isn't this how MacVim works already? The
                > window position of the first window opened is stored in the user defaults
                > and restored when the first window is opened again. Or did they change
                > something in Safari 3? (I based the current behaviour on Safari 2).

                My copy of MacVim doesn't work this way. Every window I open is the
                same, default size. I just downloaded it yesterday, so I think it's
                the newest version (not sure where to check).

                > Saving the window size brings up the following question: Which settings
                > should be autosaved? Ok, we can autosave window position and size, fine.
                > How about the toolbar contents and whether it is hidden or not? How about
                > all the other gui options (scrollbars, etc.)? Colorscheme? Et cetera.
                > Should MacVim even touch these things, since you can already set these in
                > you .gvimrc?
                >
                > I like the idea of autosaving, since this relieves the user of having to
                > know which gvimrc options to set. Also, it is pretty standard for OS X apps
                > to autosave a lot of information. My only concern is whether it will offend
                > Vim users to have all this stuff going on "behind the scenes". I could
                > always make it so that gvimrc settings override the autosaved settings;
                > would that be good?

                If I were making the app, I would probably do it like so:

                Completely ignore existing gVim implementations. Really, does any Vim
                user actually use the save button on the toolbar? We're smarter than
                that :-) Keyboard shortcuts are faster.

                Create a standard OS X Preferences window for all of the preferences I
                wanted to show via the GUI, both Vim-standard and MacVim-specific.

                Save everything in the preferences pane in the standard mac way
                (sorry, don't know what this is, a plist file I guess?). This would
                include the autosaved window size.

                Allow for everything in the preferences pane to also be set
                via .vimrc, which would override the GUI settings.

                Of course, seeing as I've got almost nil experience developing Cocoa
                apps, I can't exactly put my money where my mouth is :-)


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_mac" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Nico Weber
                ... MacVim- About. Did you change the window size via the zoom button or by using the resize handle? ... Hm, may or may not be a good idea...keeps the newbies
                Message 7 of 8 , Aug 27 7:13 PM
                • 0 Attachment
                  > My copy of MacVim doesn't work this way. Every window I open is the
                  > same, default size. I just downloaded it yesterday, so I think it's
                  > the newest version (not sure where to check).

                  MacVim->About. Did you change the window size via the zoom button or
                  by using the resize handle?

                  > Create a standard OS X Preferences window for all of the preferences I
                  > wanted to show via the GUI, both Vim-standard and MacVim-specific.

                  Hm, may or may not be a good idea...keeps the newbies away from "real
                  vim" longer, and `:options`/`:mkvimrc` is not too bad.

                  > Save everything in the preferences pane in the standard mac way
                  > (sorry, don't know what this is, a plist file I guess?). This would
                  > include the autosaved window size.

                  This is a horrible idea -- what do you do if a vim option is set both
                  in vim and the pref pane plist?

                  > Allow for everything in the preferences pane to also be set
                  > via .vimrc, which would override the GUI settings.

                  This way, if you change a pref in the prefpane, then add a line to
                  your vimrc changing the same option and removing that line years
                  later (having forgotten about the pref pane) doesn't give you the
                  default option. Furthermore, it makes your rc files less portable
                  (some settings not set in your vimrc are not what you expect).




                  Unrelated: I found a small bug. If I do `:resize options`, then the
                  MacVim window acts if it's 1 line high, but is still displayed at its
                  normal size. Hmm, happens with gvim on ubuntu as well, so this is
                  probably a vim bug (or even correct behaviour :-P). Nevermind.

                  Nico

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_mac" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • björn
                  ... You misunderstand me: what I am trying to say is that window size is _not_ autosaved, but window position is. Also, the way the window position is
                  Message 8 of 8 , Aug 28 2:55 AM
                  • 0 Attachment

                    > Apart from saving the window size, isn't this how MacVim works already?  The
                    > window position of the first window opened is stored in the user defaults
                    > and restored when the first window is opened again.  Or did they change
                    > something in Safari 3?  (I based the current behaviour on Safari 2).

                    My copy of MacVim doesn't work this way. Every window I open is the
                    same, default size. I just downloaded it yesterday, so I think it's
                    the newest version (not sure where to check).

                    You misunderstand me:  what I am trying to say is that window size is _not_ autosaved, but window position is.  Also, the way the window position is autosaved works the same way as Safari 2 does (and presumably also Safari 3, unless they've changed this behaviour).

                    At the moment, if you want a different default size then open up your .gvimrc and add 'set lines=X columns=Y', where 'X' and 'Y' are your favourite number of lines and columns, respectively.  ( I.e. Y=80 unless you are one of those mean people who write lines that are longer than what can fit on my tiny screen. ;-P)

                    > Saving the window size brings up the following question: Which settings
                    > should be autosaved?  Ok, we can autosave window position and size, fine.
                    > How about the toolbar contents and whether it is hidden or not?  How about
                    > all the other gui options (scrollbars, etc.)?  Colorscheme?  Et cetera.
                    > Should MacVim even touch these things, since you can already set these in
                    > you .gvimrc?
                    >
                    > I like the idea of autosaving, since this relieves the user of having to
                    > know which gvimrc options to set.  Also, it is pretty standard for OS X apps
                    > to autosave a lot of information.  My only concern is whether it will offend
                    > Vim users to have all this stuff going on "behind the scenes".  I could
                    > always make it so that gvimrc settings override the autosaved settings;
                    > would that be good?

                    If I were making the app, I would probably do it like so:

                    Completely ignore existing gVim implementations. Really, does any Vim
                    user actually use the save button on the toolbar? We're smarter than
                    that :-) Keyboard shortcuts are faster.

                    Create a standard OS X Preferences window for all of the preferences I
                    wanted to show via the GUI, both Vim-standard and MacVim-specific.

                    Save everything in the preferences pane in the standard mac way
                    (sorry, don't know what this is, a plist file I guess?). This would
                    include the autosaved window size.

                    Allow for everything in the preferences pane to also be set
                    via .vimrc, which would override the GUI settings.

                    Of course, seeing as I've got almost nil experience developing Cocoa
                    apps, I can't exactly put my money where my mouth is :-)

                    I'm still undecided on this topic, but I tend to think that completely ignoring current Vim behaviour is a bad idea.  Still, thanks for your opinions...I will take them into consideration.


                    /Björn

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_mac" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---

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