Merge pull request #64 from kevinhwang91/refactor

BREAKING CHANGE (developers only)

- Deleted `jump_text` option, and made it default
- Deleted the ability to override generators and granulators
This commit is contained in:
Daniel Mathiot
2022-02-08 15:49:15 +01:00
committed by GitHub
27 changed files with 554 additions and 668 deletions

View File

@@ -112,40 +112,31 @@ Or, if you want to use a key that's already used for completion purposes, take a
local cmp = require('cmp')
local neogen = require('neogen')
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col '.' - 1
return col == 0 or vim.fn.getline('.'):sub(col, col):match '%s' ~= nil
end
cmp.setup {
...
-- You must set mapping if you want.
mapping = {
["<tab>"] = cmp.mapping(function(fallback)
if neogen.jumpable() then
vim.fn.feedkeys(t("<cmd>lua require('neogen').jump_next()<CR>"), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-tab>"] = cmp.mapping(function(fallback)
if neogen.jumpable(-1) then
vim.fn.feedkeys(t("<cmd>lua require('neogen').jump_prev()<CR>"), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<tab>"] = cmp.mapping(function(fallback)
if require('neogen').jumpable() then
require('neogen').jump_next()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-tab>"] = cmp.mapping(function(fallback)
if require('neogen').jumpable(true) then
require('neogen').jump_prev()
else
fallback()
end
end, {
"i",
"s",
}),
},
...
}
@@ -169,14 +160,14 @@ If you're not satisfied with the default configuration for a language, you can c
```lua
require('neogen').setup {
enabled = true,
languages = {
lua = {
template = {
annotation_convention = "emmylua" -- for a full list of annotation_conventions, see supported-languages below,
... -- for more template configurations, see the language's configuration file in configurations/{lang}.lua
}
},
...
languages = {
lua = {
template = {
annotation_convention = "emmylua" -- for a full list of annotation_conventions, see supported-languages below,
... -- for more template configurations, see the language's configuration file in configurations/{lang}.lua
}
},
...
}
}
```