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

Dynamically resize window when adding/removing vertical splits

Expand Messages
  • elliottcable
    I’m using the Janus distribution, with includes NERDTree. My MacVim is set to open with 152 columns (113, my textwidth, plus space for NERDTree and line
    Message 1 of 2 , Jun 4, 2011
    • 0 Attachment
      I’m using the Janus distribution, with includes NERDTree. My MacVim is
      set to open with 152 columns (113, my textwidth, plus space for
      NERDTree and line numbers.)

      What I want to do, is ensure that when I open new vertical-splits from
      NERDTree (or any other way, most specificaly my secondary method of
      splitting, which is `-O` from the commandline: `mvim -O "./"
      "a_specific_file_to_begin_editing" "and_another_one"`) that the MacVim
      window itself resizes to maintain that pattern: 31 columns for
      NERDTree, plus 121 columns per vsplit.

      So, opening MacVim with two files from the command-line should set the
      MacVim window to 273 columns, with three files it should be 394,
      etcetera etcetera etcetera. The same rules should apply anytime I open
      or close a vsplit with NERDTree or `:q` or whatnot.

      Any help with this is appreciated! I’m a vim (and MacVim) noob, but
      I’m enjoying what I’m learning so far. :D

      --
      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
      ... I don t have a proper answer to this question, but let me give you a lo-tech answer that I use e.g. when viewing diffs. I ve got these mappings in my
      Message 2 of 2 , Jun 6, 2011
      • 0 Attachment
        On 5 June 2011 05:23, elliottcable wrote:
        > I’m using the Janus distribution, with includes NERDTree. My MacVim is
        > set to open with 152 columns (113, my textwidth, plus space for
        > NERDTree and line numbers.)
        >
        > What I want to do, is ensure that when I open new vertical-splits from
        > NERDTree (or any other way, most specificaly my secondary method of
        > splitting, which is `-O` from the commandline: `mvim -O "./"
        > "a_specific_file_to_begin_editing" "and_another_one"`) that the MacVim
        > window itself resizes to maintain that pattern: 31 columns for
        > NERDTree, plus 121 columns per vsplit.
        >
        > So, opening MacVim with two files from the command-line should set the
        > MacVim window to 273 columns, with three files it should be 394,
        > etcetera etcetera etcetera. The same rules should apply anytime I open
        > or close a vsplit with NERDTree or `:q` or whatnot.
        >
        > Any help with this is appreciated! I’m a vim (and MacVim) noob, but
        > I’m enjoying what I’m learning so far. :D

        I don't have a proper answer to this question, but let me give you a
        lo-tech answer that I use e.g. when viewing diffs. I've got these
        mappings in my ~/.gvimrc

        map <D-1> :set co=80<CR>
        map <D-2> :set co=165<CR>:winc =<CR>

        When I diff something (with two vertical views) I hit Cmd-2 to resize
        the window so that both views have 80 columns (the extra columns are
        for the split and the gutter). When I am finished close the split and
        hit Cmd-1 to go back to 80 columns.

        There may be a way to automate this using autocommands but I cannot
        help you with that. Try asking on vim_use.

        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
      Your message has been successfully submitted and would be delivered to recipients shortly.