Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: better venn drawing via C-hjkl to insert custom ◄▲►▼ and ascii drawing idea (requires upstream support to make the arrow direction and +-corner work correctly). #94

Open
matu3ba opened this issue Aug 30, 2023 · 0 comments

Comments

@matu3ba
Copy link

matu3ba commented Aug 30, 2023

Workaround to make graphics really tight. Motivational Python comment for an automaton:

  --   #      ┌─────────────────────────┐
  --   #      ▼  ▼──────────┐           │
  --   # inactive(1)───▼    │       maybe_active(0)
  --   #    ▲ ▼     error_detected(3)───▲
  --   #   active(2)─────▲

is much denser and does not waste 3 extra lines for the up and down corners.

Relevant lua config:

-- (◄,▼,▲,►) in utf16: (0x25C4,0x25BC,0x25B2,0x25BA)
local venn_hint = [[
 Arrow^^^^^^  Select region with <C-v>^^^^^^
 ^ ^ _K_ ^ ^  _f_: Surround with box ^ ^ ^ ^
 _H_ ^ ^ _L_  _<C-h>_: ◄, _<C-j>_: ▼
 ^ ^ _J_ ^ ^  _<C-k>_: ▲, _<C-l>_: ► _<C-c>_
]]

-- :setlocal ve=all
-- :setlocal ve=none
M.venn_hydra = Hydra {
  name = 'Draw Diagram',
  hint = venn_hint,
  config = {
    color = 'pink',
    invoke_on_body = true,
    hint = {
      border = 'rounded',
    },
    on_enter = function() vim.wo.virtualedit = 'all' end,
  },
  mode = 'n',
  body = '<leader>ve',
  heads = {
    { '<C-h>', 'xi<C-v>u25c4<Esc>' }, -- mode = 'v' somehow breaks
    { '<C-j>', 'xi<C-v>u25bc<Esc>' },
    { '<C-k>', 'xi<C-v>u25b2<Esc>' },
    { '<C-l>', 'xi<C-v>u25ba<Esc>' },
    { 'H', '<C-v>h:VBox<CR>' },
    { 'J', '<C-v>j:VBox<CR>' },
    { 'K', '<C-v>k:VBox<CR>' },
    { 'L', '<C-v>l:VBox<CR>' },
    { 'f', ':VBox<CR>', { mode = 'v' } },
    { '<C-c>', nil, { exit = true } },
  },
}

Drawing ascii eventually to be followed. My idea so far (not sure if feasible or working due to the bugs):

-- symbols (-,|,^,<,>,/,\)
local venn_hint_ascii   = [[
 - and | moves^^   Confirmation moves^^^^
 ^ ^ _K_ ^ ^ ^ ^   _<C-h>_: ◄, _<C-j>_: ▼
 _H_ ^ ^ _L_ ^ ^   ^     ^       ^   ^  ^
 ^ ^ _J_ ^ ^ ^ ^   _<C-k>_: ▲, _<C-l>_: ►
 ◄ + ▲ = \ ^ ^ ^   ◄ + ◄ / ► + ► = - / -
 ► + ▲ = / ^ ^ ^   ▲ + ▲ / ▼ + ▼ = | / |
 ◄ + ▼ = \ ^ ^ ^   other followup symbol
 ► + ▼ = / ^ ^ ^   + ◄▲► = <^> and ▼ = nop
 _F_: surround^^   _f_: surround     ^^ ^
 + corners ^  ^^   overwritten corners
                              _<C-c>_
]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant