Skip to content

Commit

Permalink
Merge pull request #635 from HicaroD/docs/config
Browse files Browse the repository at this point in the history
docs: adding Lua's equivalent code to some Vimscript's
  • Loading branch information
ms-jpq committed May 27, 2024
2 parents 251ea08 + 15c8127 commit 055d7aa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
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 })
```

0 comments on commit 055d7aa

Please sign in to comment.