]> git.madduck.net Git - etc/neovim.git/blob - .config/nvim/plugin/listmode.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

keybindings to navigate loclist
[etc/neovim.git] / .config / nvim / plugin / listmode.lua
1 vim.opt.list = true
2 vim.opt.listchars = { tab = '⇝·', trail = '·', nbsp = '␣' }
3
4 -- disable list mode when inserting stuff, otherwise keep it enabled, it's
5 -- useful (see also setting lcs)
6 listinsert = vim.api.nvim_create_augroup('listinsert', { clear = true })
7 vim.api.nvim_create_autocmd('InsertEnter', {
8         desc = 'Disable list mode when starting to insert',
9         group = listinsert,
10         callback = function() vim.opt.list = false end
11 })
12 vim.api.nvim_create_autocmd('InsertLeave', {
13         desc = 'Enable list mode when leaving insert mode',
14         group = listinsert,
15         callback = function() vim.opt.list = true end
16 })
17 -- flag trailing spaces as error only when not inserting
18 tsperrorinsert = vim.api.nvim_create_augroup('tsperrorinsert', { clear = true })
19 vim.api.nvim_create_autocmd('InsertEnter', {
20         desc = 'Disable highlighting trailing spaces in insert mode',
21         group = tsperrorinsert,
22         callback = function() vim.cmd([[match none /\s\+$/]]) end
23 })
24 vim.api.nvim_create_autocmd('InsertLeave', {
25         desc = 'Enable highlighting trailing spaces outside of insert mode',
26         group = tsperrorinsert,
27         callback = function() vim.cmd([[match Error /\s\+$/]]) end
28 })