Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding Lua's equivalent code to some Vimscript's #635

Merged
merged 4 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/CONF.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let g:coq_settings = { ... }
Lua:

```lua
local vim.g.coq_settings = { ... }
vim.g.coq_settings = { ... }
```

---
Expand Down Expand Up @@ -51,10 +51,22 @@ Variables will be validated against a schema.

ie.

Vim:

```vim
let g:coq_settings = { 'match.look_ahead': 'dog' }
```

Lua:

```lua
vim.g.coq_settings = {
match = {
look_ahead = "dog",
},
}
```

Will give you the following error message:

![conf_demo.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/conf.png)
Expand Down
29 changes: 28 additions & 1 deletion docs/KEYBIND.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ null
Map the manual keybinding trigger only in `INSERT` mode.

**default**:

```json
false
```

## Custom keybindings

If you would like to set your own keybindings, add the following to your
init.vim and edit them to your liking.
`init.vim` and edit them to your liking.

```vim
" 🐓 Coq completion settings
Expand All @@ -130,3 +131,29 @@ ino <silent><expr> <CR> pumvisible() ? (complete_info().selected == -1 ? "\<C
ino <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
ino <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<BS>"
```

If you're using Neovim, add this to your `init.lua`

```lua
-- 🐓 Coq completion settings

-- Set recommended to false
vim.g.coq_settings = {
keymap = {
recommended = false,
},
}

-- Keybindings
vim.api.nvim_set_keymap('i', '<Esc>', [[pumvisible() ? "\<C-e><Esc>" : "\<Esc>"]], { expr = true, silent = true })
vim.api.nvim_set_keymap('i', '<C-c>', [[pumvisible() ? "\<C-e><C-c>" : "\<C-c>"]], { expr = true, silent = true })
vim.api.nvim_set_keymap('i', '<BS>', [[pumvisible() ? "\<C-e><BS>" : "\<BS>"]], { expr = true, silent = true })
vim.api.nvim_set_keymap(
"i",
"<CR>",
[[pumvisible() ? (complete_info().selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>"]],
{ expr = true, silent = true }
)
vim.api.nvim_set_keymap('i', '<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { expr = true, silent = true })
vim.api.nvim_set_keymap('i', '<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<BS>"]], { expr = true, silent = true })
```