20251116

VimHaradaMethod - gimme a grid

Took a while to get this VibeCoded and still the center swap toggle did not work. Was going for the old iMandalArt iOS functionality but sadly it is lost in the Japanese internets.

Usage

at buffer, :HaradaMethod to get the grid
\z toggles zoom of that focused pane
Move with the usual C-W hjkl movements or splits 1-9 starting from top left  <split number> C-W w
gf works as usual 

Script

" ------------------------------------------------------------------------------

" 1. CONFIGURATION

" ------------------------------------------------------------------------------

set hidden 


" ------------------------------------------------------------------------------

" 2. The Core Grid Logic

" ------------------------------------------------------------------------------

function! s:CreateHaradaMethodGrid()

    botright split | botright split   

    wincmd t | rightbelow vsplit | rightbelow vsplit

    wincmd j | rightbelow vsplit | rightbelow vsplit

    wincmd j | rightbelow vsplit | rightbelow vsplit

    wincmd =

    windo setlocal nocursorline nocursorcolumn

    5wincmd w

    setlocal cursorline cursorcolumn

    let t:zoomed = 0

endfunction

 ------------------------------------------------------------------------------

" 3. Zoom Logic 

" ------------------------------------------------------------------------------

function! s:ToggleZoom()

    if exists("t:zoomed") && t:zoomed

        wincmd =

        let t:zoomed = 0

        redraw

        echo "Zoom: Off"

    else

        wincmd _ | wincmd |

        let t:zoomed = 1

        redraw

        echo "Zoom: On"

    endif

endfunction


" ------------------------------------------------------------------------------

" 4. Mappings

" ------------------------------------------------------------------------------

command! HaradaMethod call s:CreateHaradaMethodGrid()


" The Toggle Switch

nnoremap <Leader>z :call <SID>ToggleZoom()<CR>

nnoremap gf :e <cfile><CR>


" ------------------------------------------------------------------------------

" 5. Direct Pane Navigation (1-9)

" ------------------------------------------------------------------------------

" just use <number> C-W w as in goto center pane with 5C-W w or C-W hjkl


No comments:

Post a Comment