summaryrefslogtreecommitdiffstats
path: root/.config/nvim/autoload
diff options
context:
space:
mode:
authorYigit Sever2020-10-15 23:09:00 +0300
committerYigit Sever2020-10-15 23:09:00 +0300
commit1b044dcd159e86a20d14cd4cefb3c696f563a9f3 (patch)
treeeac5247e14c0676bbd8d782ad586fa4c2d424d97 /.config/nvim/autoload
parent3d82b538912c4ea4054938e565039623ca443e91 (diff)
downloaddotfiles-1b044dcd159e86a20d14cd4cefb3c696f563a9f3.tar.gz
dotfiles-1b044dcd159e86a20d14cd4cefb3c696f563a9f3.tar.bz2
dotfiles-1b044dcd159e86a20d14cd4cefb3c696f563a9f3.zip
tracking mailcomplete
Diffstat (limited to '.config/nvim/autoload')
-rw-r--r--.config/nvim/autoload/mailcomplete.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/nvim/autoload/mailcomplete.vim b/.config/nvim/autoload/mailcomplete.vim
new file mode 100644
index 0000000..c750b52
--- /dev/null
+++ b/.config/nvim/autoload/mailcomplete.vim
@@ -0,0 +1,33 @@
1" This is based on (that is, mostly copy-pasted from) [here][1], but uses Khard [2] rather
2" than GooBook [3]. Also see `:h 'omnifunc'`. TODO: maybe prettify this a bit. TODO:
3" consider whether there's something worth stealing from how Greg Hurrell set up
4" autocompletion. See [4], [5], [6], etc.
5function! mailcomplete#Complete(findstart, base)
6 if a:findstart == 1
7 let line = getline('.')
8 let idx = col('.')
9 while idx > 0
10 let idx -= 1
11 let c = line[idx]
12 if c == ':' || c == '>'
13 return idx + 2
14 else
15 continue
16 endif
17 endwhile
18 return idx
19 else
20 return split(system('khard email -p --remove-first-line ' . a:base .
21 \ ' | awk -F "\t" ''{ print $2" <"$1">" }'''), '\n')
22 endif
23endfunction
24
25" [1]: https://web.archive.org/web/20160915070551/http://www.recursivedream.com/blog/2012/auto-completing-google-contacts-in-vim
26" [2]: https://github.com/scheibler/khard
27" [3]: https://gitlab.com/goobook/goobook
28" [4]: https://youtu.be/9zffUQsbxgE "Vim screencast #49: Sending email with vim"
29" [5]: https://youtu.be/VBLh56J89do "Vim screencast #51: Composing email"
30" [6]: https://youtu.be/BNnSjJOpXDk "Vim screencast #58: deoplete.nvim"
31" [7]: https://github.com/wincent/wincent/blob/9350820fd0fe/roles/dotfiles/files/.vim/plugin/autocomplete.vim#L46-L74
32" [8]: https://github.com/wincent/ycmd/commit/cb90aa61dcd8135351bb8afd7c39e90d653313c5
33" [9]: https://github.com/fszymanski/deoplete-abook