Fork me on GitHub
#vim
<
2022-06-07
>
Nundrum23:06:53

Here's the best find recently: https://medium.com/@vinodkri/zooming-vim-window-splits-like-a-pro-d7a9317d40 It's already making my life easier!

👏 1
dave12:06:15

I have something similar in my setup:

" Zoom/restore a window
" source: 
function! s:ZoomToggle() abort
  if exists('t:zoomed') && t:zoomed
    execute t:zoom_winrestcmd
    let t:zoomed = 0
  else
    let t:zoom_winrestcmd = winrestcmd()
    resize
    vertical resize
    let t:zoomed = 1
  endif
endfunction

command! ZoomToggle call s:ZoomToggle()

nnoremap <leader>a :ZoomToggle<CR>
It doesn't automatically split windows to be equally sized, but it does remember the sizes of your windows before zooming, and restore them when you toggle zoom off. Very handy!

Proctor15:06:53

♥️ ♥️ ♥️

Proctor15:06:09

just translated that into some Fennel

Proctor15:06:16

(module dotfiles.zoom-toggle
  {autoload
   {a aniseed.core}
   require
   {anenv aniseed.env
    nvim aniseed.nvim
    nu aniseed.nvim.util
    u dotfiles.util}})

(var unzoom! nil)

(defn zoom-toggle []
  (if unzoom!
    (do
      (nvim.command unzoom!)
      (set unzoom! nil))
    (do
      (set unzoom! (nvim.fn.winrestcmd))
      (nvim.ex.resize)
      (nvim.ex.vertical :resize))))


(nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false})
(u.nnoremap :<C-W>z ":call ZoomToggle()<CR>")

dave15:06:33

Nice! 🙌

Proctor17:06:29

Really nice with Conjure output pane and want to dig deep into more complex output