Skip to content

Instantly share code, notes, and snippets.

@dusanx
Created September 27, 2021 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dusanx/9ee6a5ba5a4b0d82714a68d8d35694e2 to your computer and use it in GitHub Desktop.
Save dusanx/9ee6a5ba5a4b0d82714a68d8d35694e2 to your computer and use it in GitHub Desktop.
Testing g:gtk_nocache values
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LIGATURE
" :so ~/ligature.vim | LIGATURE
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
command! -bar -complete=file -nargs=? LIGATURE call s:ligature_cmd(<q-args>)
function! s:ligature_cmd(arg) abort
enew
setlocal bufhidden=wipe buftype=nofile nobuflisted nocursorcolumn nocursorline nolist nonumber noswapfile norelativenumber cursorline
setlocal modifiable nomodified
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let l:g=[0x00000000, 0xfc00ffff, 0xf8000001, 0x78000001]
call s:check(l:g[0], 0, 32)
call s:check(l:g[1], 0+32, 32)
call s:check(l:g[2], 32+32, 32)
call s:check(l:g[2], 64+32, 32)
"let l:check = printf("%b", l:g[1])
"let l:bitpos = 1
"call append('$', l:check)
"while l:i <= 31
" if (l:check[l:bitpos] == '1')
" call append('$', printf("%3i", l:i) . ' YES ' .nr2char(l:i))
" else
" call append('$', printf("%3i", l:i) . ' no ' .nr2char(l:i))
" endif
" let l:i += 1
" let l:bitpos += 1
"endwhile
"call append('$', '')
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
setlocal nomodifiable nomodified
call cursor(1,1)
endfunction
function! s:check(mask, start, len)
let l:check = printf("%032b", a:mask)
let l:bitpos = 31
call append('$', l:check)
let l:i = a:start
while l:i <= (a:start + a:len - 1)
if (l:check[l:bitpos] == '1')
call append('$', printf("%3i", l:i) . ' ----YES---- ' .nr2char(l:i))
else
"call append('$', printf("%3i", l:i) . ' ----no-- ' .nr2char(l:i))
endif
let l:i += 1
let l:bitpos -= 1
endwhile
call append('$', '')
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LIGATURE TEST
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
command! -bar -complete=file -nargs=? LIGATURE2 call s:ligature2_cmd(<q-args>)
function! s:ligature2_cmd(arg) abort
let l:mask = "!\"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~"
enew
setlocal bufhidden=wipe buftype=nofile nobuflisted nocursorcolumn nocursorline nolist nonumber noswapfile norelativenumber cursorline
setlocal modifiable nomodified
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let l:mask_chars = split(l:mask, '\zs')
for l:i in l:mask_chars
call append('$', l:i)
endfor
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
setlocal nomodifiable nomodified
call cursor(1,1)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment