Skip to content

rapan931/binary_comments.vim

Repository files navigation

binary_comments.vim

Add comments to the binary

Install

vim-plug

Plug 'rapan931/binary_comments.vim'

packer.nvim
vim-jetpack

use 'rapan931/binary_comments.vim'

Demo

binary_comments

Usage

neovim

vim.keymap.set('x', 'ge', require('binary_comments').draw)

vim

xmap ge <Plug>(binary-comments-draw)

Setup

neovim

-- This sample is default value. 
-- If you do not need to change the set values, there is no need to call setup
require('binary_comments').setup({
  corner = {
    top_left = vim.fn.strdisplaywidth('') == 1 and '' or '+',
    bottom_left = vim.fn.strdisplaywidth('') == 1 and '' or '+',
  },
  vert = vim.fn.strdisplaywidth('') == 1 and '' or '|',
  hori = vim.fn.strdisplaywidth('') == 1 and '' or '-',
  draw_below = true,  -- draw position, if false, ruled lines on above of binary
})

vim(legacy vim script)

" This sample is default value.
" If you do not need to change the set values, there is no need to call setup
let g:binary_comments#corner = #{
      \   top_left: strdisplaywidth('') == 1 ? '' : '+',
      \   bottom_left: strdisplaywidth('') == 1 ? '' : '+',
      \ }
let g:binary_comments#vert = strdisplaywidth('') == 1 ? '' : '|'
let g:binary_comments#hori = strdisplaywidth('') == 1 ? '' : '-'
let g:binary_comments#draw_below = v:true

vim(vim9script)

" This sample is default value.
" If you do not need to change the set values, there is no need to call setup
g:binary_comments#corner = {
  top_left: strdisplaywidth('') == 1 ? '' : '+',
  bottom_left: strdisplaywidth('') == 1 ? '' : '+',
}
g:binary_comments#vert = strdisplaywidth('') == 1 ? '' : '|'
g:binary_comments#hori = strdisplaywidth('') == 1 ? '' : '-'
g:binary_comments#draw_below = true