summaryrefslogtreecommitdiff
path: root/files/nvim/local
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-11-12 22:26:02 -0500
committerAndrew Opalach <andrew@akon.city> 2024-11-12 22:36:49 -0500
commit53a0a5473f45d37027af9663638adbf56667e4ca (patch)
tree05c6c39678a9005f95c00e0fdf31193657bd4d3d /files/nvim/local
downloaddotfiles-53a0a5473f45d37027af9663638adbf56667e4ca.tar.gz
dotfiles-53a0a5473f45d37027af9663638adbf56667e4ca.tar.bz2
dotfiles-53a0a5473f45d37027af9663638adbf56667e4ca.zip
Hopefully no leaks
Diffstat (limited to 'files/nvim/local')
-rw-r--r--files/nvim/local/autoload/Juliana.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/files/nvim/local/autoload/Juliana.vim b/files/nvim/local/autoload/Juliana.vim
new file mode 100644
index 0000000..1b684b9
--- /dev/null
+++ b/files/nvim/local/autoload/Juliana.vim
@@ -0,0 +1,46 @@
+" https://github.com/neitanod/vim-clevertab
+
+function! Juliana#Init()
+ let g:Juliana#has_selection = 0
+ augroup JulianaPersistAu
+ autocmd ModeChanged [V\x16]*:i let g:Juliana#has_selection = 1
+ autocmd InsertLeave * let g:Juliana#has_selection = 0
+ augroup END
+endfunction
+
+function! Juliana#CompleteTab(type)
+ if a:type == "START"
+ let g:Juliana#stop=0
+ return ""
+ endif
+
+ if !g:Juliana#stop
+ " Vanilla <Tab> if we are at the front of a line.
+ if a:type == "TAB" && col(".") >= col("$") && !pumvisible()
+ let g:Juliana#stop=1
+ return "\<Tab>"
+ elseif a:type == "ALIGN" && !pumvisible() " Align if !pumvisible().
+ let g:Juliana#stop=1
+ if g:Juliana#has_selection
+ return "\<ESC>gv=i"
+ else
+ return "\<ESC>\<C-v>=i"
+ endif
+ elseif a:type == "NEXT" " If pumvisible(), goto the next result.
+ let g:Juliana#stop=1
+ return "\<C-n>"
+ endif
+ endif
+
+ return ""
+endfunction
+
+function! Juliana#CompleteSTab(type)
+ if a:type == "PREV"
+ if pumvisible() " If pumvisible(), goto the previous result.
+ return "\<C-p>"
+ else
+ return "\<Tab>" " <S-Tab> = <Tab>
+ endif
+ endif
+endfunction