nvim-kickstart-python
nvim-kickstart-python copied to clipboard
Use keymap.set over cmd.inoreabbrev
trafficstars
'ia' as the mode is an insert mode abbreviation, since a while ago - not sure when exactly:
vim.keymap.set('ia', '--', '#', { buffer = true })
Or if you want to have fun,
vim.iter {
true = 'True',
false = 'False',
['--'] = '#',
null = 'None',
none = 'None',
nil = 'None',
}:each(function(lhs, rhs)
vim.keymap.set('ia', lhs, rhs, { buffer = true })
end)
Or
local iabbrev = function(lhs, rhs)
vim.keymap.set('ia', lhs, rhs, { buffer = true })
end
iabbrev('true', 'True')
iabbrev('false', 'False')
iabbrev('--', '#')
iabbrev('null', 'None')
iabbrev('none', 'None')
iabbrev('nil', 'None')
oh nice, I didn't know about that one.
Could it be that you are on nightly though? I am on 0.9.2, and trying ia as mode results in an error for me
edit: yep, it's only supported on nightly
I will probably leave at as vim.cmd.iabbr until around nvim 0.11.
Update to using keymap.set as nvim 0.10 has been released.
(Not using vim.iter to keep it simple for new users :) )