diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-15 20:28:13 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-15 20:28:13 +0200 |
| commit | 17e319a4455f3135ed3cc759dee8ba5034fde75b (patch) | |
| tree | 6d07c1875ae2736a5f3eb026a243328ab5c73fca /.local/share/nvim/site/autoload/brackify.vim | |
| parent | 346854ff3ea83202de7437f01f1c1c336f4c3edf (diff) | |
Diffstat (limited to '.local/share/nvim/site/autoload/brackify.vim')
| -rw-r--r-- | .local/share/nvim/site/autoload/brackify.vim | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/.local/share/nvim/site/autoload/brackify.vim b/.local/share/nvim/site/autoload/brackify.vim deleted file mode 100644 index ca2a834..0000000 --- a/.local/share/nvim/site/autoload/brackify.vim +++ /dev/null @@ -1,39 +0,0 @@ -function! CharAtIdx(str, idx) abort - return strcharpart(a:str, a:idx, 1) -endfunction - -function! CursorCharIdx() abort - let cursor_byte_idx = col('.') - if cursor_byte_idx == 1 - return 0 - endif - - let pre_cursor_text = getline('.')[:col('.')-2] - return strchars(pre_cursor_text) -endfunction - -function brackify#putbracket(bracket) - let cur_char_idx = CursorCharIdx() - let cur_char = CharAtIdx(getline('.'), cur_char_idx + 1) - - if cur_char != a:bracket - let line = getline('.')[:col('.') - 1] . a:bracket . getline('.')[col('.'):] - call setline(line("."), line) - endif -endfunction - -function brackify#putquotes(quote) - let cur_char_idx = CursorCharIdx() - let cur_char = CharAtIdx(getline('.'), cur_char_idx + 1) - - if cur_char != a:quote - let line = getline('.')[:col('.') - 1] . a:quote . a:quote . getline('.')[col('.'):] - call setline(line("."), line) - - if col('.') > 1 - call cursor(getpos('.')[1], col('.') + 1) - endif - else - call cursor(getpos('.')[1], col('.') + 1) - endif -endfunction |