Skip to content

Commit

Permalink
cvb : 10진법 수를 2진법 수로 변환하는 명령
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrib committed Mar 3, 2023
1 parent f2ed28b commit 3312f69
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nvim/init.vim
Expand Up @@ -325,6 +325,25 @@ let g:coc_global_extensions = [
" https://vim.fandom.com/wiki/Search_for_visually_selected_text
vnoremap <Space>* y/\V<C-R>=escape(@",'/\')<CR><CR>
function! DecimalToBinary(input)
let l:num = a:input

if l:num == 0
return 0
endif

let l:bin = ''
while l:num > 0
let l:bin = l:num % 2 . l:bin
let l:num = l:num / 2
endwhile

return l:bin
endfunction

" converts decimal to binary
nnoremap cvb :let temp_num=DecimalToBinary(expand("<cword>"))<CR>ciw<C-r>=temp_num<CR>
"Bubble lines
" nnoremap <M-K> ddkP
" nnoremap <M-J> ddp
Expand Down

0 comments on commit 3312f69

Please sign in to comment.