diff options
author | Yigit Sever | 2020-05-15 02:33:27 +0300 |
---|---|---|
committer | Yigit Sever | 2020-05-15 02:33:27 +0300 |
commit | 68de9265655f6a6a92c12aa9a948b9dbef311c08 (patch) | |
tree | a9bd241354ff3f9d0980e35f348a6e1b196b576d /.config/nvim | |
parent | 75f18db25d453fafcf19121384198f3e96250c9d (diff) | |
download | dotfiles-68de9265655f6a6a92c12aa9a948b9dbef311c08.tar.gz dotfiles-68de9265655f6a6a92c12aa9a948b9dbef311c08.tar.bz2 dotfiles-68de9265655f6a6a92c12aa9a948b9dbef311c08.zip |
nvim ft files
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/after/ftplugin/mail.vim | 53 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/rust.vim | 2 |
2 files changed, 55 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/mail.vim b/.config/nvim/after/ftplugin/mail.vim new file mode 100644 index 0000000..b48389a --- /dev/null +++ b/.config/nvim/after/ftplugin/mail.vim | |||
@@ -0,0 +1,53 @@ | |||
1 | setl spell | ||
2 | setl omnifunc=mailcomplete#Complete | ||
3 | |||
4 | function! s:OnExit(job_id, code, event) dict | ||
5 | if a:code == 0 | ||
6 | " NeoMutt successfully sent the mail. Get rid of the terminal buffer and window. | ||
7 | " We can't use plain `bd!` because the terminal window may no longer have focus. | ||
8 | execute 'bd!' s:bufnr | ||
9 | " Quit if we succeeded in sending the email and there's only one buffer left. | ||
10 | if len(getbufinfo({'buflisted': 1})) == 1 | ||
11 | quit | ||
12 | endif | ||
13 | else | ||
14 | " We didn't send the mail. Go back to the buffer with the message. FIXME: we | ||
15 | " probably shouldn't rely on a [plugin][1]. | ||
16 | execute 'Bd!' s:bufnr | ||
17 | endif | ||
18 | endfunction | ||
19 | " [1]: https://github.com/moll/vim-bbye | ||
20 | " [2]: https://github.com/neovim/neovim/issues/4291 | ||
21 | " [3]: https://vi.stackexchange.com/q/10292 | ||
22 | " [4]: https://redd.it/46g5wy | ||
23 | " [5]: https://github.com/neovim/neovim/issues/5176 | ||
24 | |||
25 | function! s:SendMail() | ||
26 | let l:message_file = expand('%') | ||
27 | if l:message_file != '' | ||
28 | update | ||
29 | else | ||
30 | " Cope with the buffer not having an associated file. TODO: delete this file if we | ||
31 | " succeed in sending the mail? | ||
32 | let l:message_file = system('mktemp') | ||
33 | execute 'w!' l:message_file | ||
34 | endif | ||
35 | enew | ||
36 | " Tell NeoMutt to use `true` as the editor. This makes it show the compose menu | ||
37 | " directly instead of starting Vim inside of Vim. Also don't use the curses pinentry | ||
38 | " program. There seem to be some issues when using it from NeoMutt inside Vim inside | ||
39 | " screen(1). | ||
40 | call termopen('VISUAL=true PINENTRY_USER_DATA=gtk neomutt ' . | ||
41 | \ "-e 'set postpone=no sidebar_visible=no assumed_charset=utf-8' " . | ||
42 | \ "-H " . l:message_file, {'on_exit': function('s:OnExit')}) | ||
43 | let s:bufnr = bufnr('%') | ||
44 | startinsert | ||
45 | endfunction | ||
46 | |||
47 | nnoremap <buffer> <silent> <C-H> :<C-U>call <SID>SendMail()<CR> | ||
48 | |||
49 | nnoremap <buffer> <silent> <localleader>f gg/From:<CR>:nohlsearch<CR>4lC: | ||
50 | nnoremap <buffer> <silent> <localleader>t gg/To:<CR>:nohlsearch<CR>2lC: | ||
51 | nnoremap <buffer> <silent> <localleader>c gg/Cc:<CR>:nohlsearch<CR>2lC: | ||
52 | nnoremap <buffer> <silent> <localleader>b gg/Bcc:<CR>:nohlsearch<CR>3lC: | ||
53 | nnoremap <buffer> <silent> <localleader>s gg/Subject:<CR>:nohlsearch<CR>7lC: | ||
diff --git a/.config/nvim/after/ftplugin/rust.vim b/.config/nvim/after/ftplugin/rust.vim new file mode 100644 index 0000000..542d070 --- /dev/null +++ b/.config/nvim/after/ftplugin/rust.vim | |||
@@ -0,0 +1,2 @@ | |||
1 | let b:ale_fixers = ['rustfmt'] | ||
2 | let b:ale_linters = ['rls'] | ||