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

Hack for centering text horizontally in fullscreen mode?

Expand Messages
  • russmcb
    Anyone have a hack we can use to put text into the center of the screen when going into fullscreen mode? Currently, you have to turn to the left to see your
    Message 1 of 8 , Oct 21, 2011
    • 0 Attachment
      Anyone have a hack we can use to put text into the center of the
      screen when going into fullscreen mode? Currently, you have to turn
      to the left to see your content when in full-screen mode. Bonus
      points for automatically increasing the font size in fullscreen mode.

      --
      You received this message from the "vim_mac" 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
    • Carlos Galdino
      Well, I tried to create a function to enter/leave fullscreen mode but I still don’t know why it doesn’t work very well. But here is the function in case
      Message 2 of 8 , Oct 22, 2011
      • 0 Attachment
        Well, I tried to create a function to enter/leave fullscreen mode but I still don’t know why it doesn’t work very well.

        But here is the function in case you want to try yourself: https://gist.github.com/1272896

        If you have any luck, tell me. =)

        -- 
        Carlos Galdino

        On Saturday, October 22, 2011 at 12:31 AM, russmcb wrote:


        Anyone have a hack we can use to put text into the center of the
        screen when going into fullscreen mode? Currently, you have to turn
        to the left to see your content when in full-screen mode. Bonus
        points for automatically increasing the font size in fullscreen mode.

        --
        You received this message from the "vim_mac" 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 from the "vim_mac" 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
      • Russ McBride
        Thanks Carlos, Vimscript is almost enough to make me switch over to emacs or use one of the vi modes for emacs like viper or evil… but that s a different
        Message 3 of 8 , Oct 22, 2011
        • 0 Attachment

          Thanks Carlos,

          Vimscript is almost enough to make me switch over to emacs or use one of the vi modes for emacs like viper or evil… but that's a different topic….

          What I found is that for my needs the simple solution was to just get rid of this line from my .gvimrc file (or comment it out):
          set fuoptions=maxhorz,maxvert

          Now, when I switch into fullscreen, MacVim automagically goes max vertical and centers horizontally, with the column width set to whatever the window width was set to before I went fullscreen.  Nice.  And simple.  Of course, this doesn't help you if you want a standard column width *whenever* you go into fullscreen mode.  But it shouldn't be too hard to get your script working for that purpose.

          cheers,
          russ


          On Oct 22, 2011, at 8:24 AM, Carlos Galdino wrote:

          Well, I tried to create a function to enter/leave fullscreen mode but I still don’t know why it doesn’t work very well.

          But here is the function in case you want to try yourself: https://gist.github.com/1272896

          If you have any luck, tell me. =)

          -- 
          Carlos Galdino

          On Saturday, October 22, 2011 at 12:31 AM, russmcb wrote:


          Anyone have a hack we can use to put text into the center of the
          screen when going into fullscreen mode? Currently, you have to turn
          to the left to see your content when in full-screen mode. Bonus
          points for automatically increasing the font size in fullscreen mode.

          --
          You received this message from the "vim_mac" 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 from the "vim_mac" 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 from the "vim_mac" 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
        • Andrew Stewart
          ... Yes, it s suboptimal to say the least. However you can mitigate the pain by scripting Vim in Ruby, Python, Perl, etc, with a little boilerplate Vimscript
          Message 4 of 8 , Oct 23, 2011
          • 0 Attachment
            On 22 Oct 2011, at 19:53, Russ McBride wrote:
            > Vimscript is almost enough to make me switch over to emacs or use one of the vi modes for emacs like viper or evil… but that's a different topic….

            Yes, it's suboptimal to say the least. However you can mitigate the pain by scripting Vim in Ruby, Python, Perl, etc, with a little boilerplate Vimscript wrapper.

            Yours,
            Andy Stewart
            -------
            http://airbladesoftware.com

            --
            You received this message from the "vim_mac" 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
          • Andrew Stewart
            On 22 Oct 2011, at 19:53, Russ McBride wrote: Vimscript is almost enough to make me switch over to emacs or use one of the vi modes for emacs like viper or
            Message 5 of 8 , Oct 23, 2011
            • 0 Attachment

              On 22 Oct 2011, at 19:53, Russ McBride wrote:
              Vimscript is almost enough to make me switch over to emacs or use one of the vi modes for emacs like viper or evil… but that's a different topic….

              Yes, it's suboptimal to say the least.  However you can mitigate the pain by scripting Vim in Ruby, Python, Perl, etc, with a little boilerplate Vimscript wrapper.

              Yours,
              Andy Stewart
              -------
              http://airbladesoftware.com

              --
              You received this message from the "vim_mac" 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
            • Giovanni Lanzani
              I did just that, comment out set fuoptions=maxhorz,maxvert however that didn t do the trick -- You received this message from the vim_mac maillist. Do not
              Message 6 of 8 , Oct 24, 2011
              • 0 Attachment
                I did just that, comment out 

                    set fuoptions=maxhorz,maxvert

                however that didn't do the trick

                --
                You received this message from the "vim_mac" 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
              • björn
                ... You need to set fuopt=maxvert See :h fuopt for more information. As for changing font size and number of columns when toggling full-screen, try adding
                Message 7 of 8 , Oct 24, 2011
                • 0 Attachment
                  On 24 October 2011 14:43, Giovanni Lanzani wrote:
                  > I did just that, comment out
                  >     set fuoptions=maxhorz,maxvert
                  > however that didn't do the trick

                  You need to

                  set fuopt=maxvert

                  See ":h 'fuopt" for more information.

                  As for changing font size and number of columns when toggling
                  full-screen, try adding these three lines (re-join them so that they
                  form three lines in case they have been split when I posted them) to
                  your ~/.gvimrc:

                  ----- 8< ----
                  set fuopt=maxvert

                  command! ToggleFullScreen if &fu|set gfn=Menlo:h13|set co=80|set
                  nofu|else|set gfn=Menlo:h18|set co=120|set fu|endif

                  an <silent> Window.Toggle\ Full\ Screen\ Mode :ToggleFullScreen<CR>
                  ----- >8 ----

                  Note that I've had reports that changing 'co' and 'fu' at the same
                  time can fail so I can't guarantee that the above works. However,
                  I've just tested it and it works fine for me. Also note that in order
                  for it to work you have to enter full-screen by using the menu, or by
                  pressing the shortcut for the menu (which should be Cmd+Ctrl+f unless
                  you are using an old version of MacVim).

                  Björn

                  --
                  You received this message from the "vim_mac" 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
                • Russ McBride
                  Thanks, Björn. Doing this works fine: set fuopt=maxvert But the default is maxvert so it s good as is. And it s nice to have the width in fullscreen get set
                  Message 8 of 8 , Oct 24, 2011
                  • 0 Attachment
                    Thanks, Björn.

                    Doing this works fine:
                    set fuopt=maxvert

                    But the default is maxvert so it's good as is. And it's nice to have the width in fullscreen get set to the same as whatever you set in non-fullscreen. Being able to set the width by just mouse dragging in lion is nice.

                    I didn't know about gfn. Cool.

                    I'm assuming your command go inside this block:
                    if has("gui_macvim")…

                    When I do that, I can't go into fullscreen. When I keep them outside of that block, they don't do anything (but I can go into fullscreen).

                    Can someone give me a pointer to vim scripting? Maybe this 5-part series:
                    http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html

                    On another note, the best thing I ever did for Vim productivity was to switch my caps lock key to esc. I used this:
                    http://pqrs.org/macosx/keyremap4macbook/extra.html


                    Cheers,
                    russ




                    On Oct 24, 2011, at 7:09 AM, björn wrote:

                    > On 24 October 2011 14:43, Giovanni Lanzani wrote:
                    >> I did just that, comment out
                    >> set fuoptions=maxhorz,maxvert
                    >> however that didn't do the trick
                    >
                    > You need to
                    >
                    > set fuopt=maxvert
                    >
                    > See ":h 'fuopt" for more information.
                    >
                    > As for changing font size and number of columns when toggling
                    > full-screen, try adding these three lines (re-join them so that they
                    > form three lines in case they have been split when I posted them) to
                    > your ~/.gvimrc:
                    >
                    > ----- 8< ----
                    > set fuopt=maxvert
                    >
                    > command! ToggleFullScreen if &fu|set gfn=Menlo:h13|set co=80|set
                    > nofu|else|set gfn=Menlo:h18|set co=120|set fu|endif
                    >
                    > an <silent> Window.Toggle\ Full\ Screen\ Mode :ToggleFullScreen<CR>
                    > ----- >8 ----
                    >
                    > Note that I've had reports that changing 'co' and 'fu' at the same
                    > time can fail so I can't guarantee that the above works. However,
                    > I've just tested it and it works fine for me. Also note that in order
                    > for it to work you have to enter full-screen by using the menu, or by
                    > pressing the shortcut for the menu (which should be Cmd+Ctrl+f unless
                    > you are using an old version of MacVim).
                    >
                    > Björn
                    >
                    > --
                    > You received this message from the "vim_mac" 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 from the "vim_mac" 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
                  Your message has been successfully submitted and would be delivered to recipients shortly.