Compare commits
2 commits
50937a342f
...
4dc4cdf7e3
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dc4cdf7e3 | |||
|
|
7efb98baab |
5 changed files with 55 additions and 84 deletions
46
.arclint
46
.arclint
|
|
@ -1,46 +0,0 @@
|
||||||
{
|
|
||||||
"linters": {
|
|
||||||
"stylua": {
|
|
||||||
"type": "script-and-regex",
|
|
||||||
"script-and-regex.script": "sh -c 'stylua --check \"$0\" || true'",
|
|
||||||
"script-and-regex.regex": "/(?P<line>\\d+).*\\|\\-/m",
|
|
||||||
"include": "(\\.lua$)"
|
|
||||||
},
|
|
||||||
"luacheck": {
|
|
||||||
"type": "script-and-regex",
|
|
||||||
"script-and-regex.script": "sh -c 'luacheck \"$0\" || true'",
|
|
||||||
"script-and-regex.regex": "/^.*?:(?P<line>\\d+):(?P<char>\\d+):\\s+\\((?P<code>\\w+)\\) (?P<message>.*?)$/m",
|
|
||||||
"include": "(\\.lua$)"
|
|
||||||
},
|
|
||||||
"cargo": {
|
|
||||||
"type": "script-and-regex",
|
|
||||||
"script-and-regex.script": "sh -c 'cargo fmt --check --'",
|
|
||||||
"script-and-regex.regex": "/(?P<message>.*?)/",
|
|
||||||
"include": "(\\.rs$)"
|
|
||||||
},
|
|
||||||
"clippy": {
|
|
||||||
"type": "script-and-regex",
|
|
||||||
"script-and-regex.script": "sh -c 'cargo clippy --'",
|
|
||||||
"script-and-regex.regex": "/(?P<message>.*?)/",
|
|
||||||
"include": "(\\.rs$)"
|
|
||||||
},
|
|
||||||
"prettier": {
|
|
||||||
"type": "script-and-regex",
|
|
||||||
"script-and-regex.script": "prettier --check",
|
|
||||||
"script-and-regex.regex": "/(?P<message>.*?)/",
|
|
||||||
"include": "(\\.yml$|\\.json[c5]?$|\\.[tj]sx?$)"
|
|
||||||
},
|
|
||||||
"merge-conflict": {
|
|
||||||
"type": "merge-conflict"
|
|
||||||
},
|
|
||||||
"text": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"chmod": {
|
|
||||||
"type": "chmod"
|
|
||||||
},
|
|
||||||
"generated": {
|
|
||||||
"type": "generated"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
48
README.md
48
README.md
|
|
@ -21,6 +21,7 @@ git clone https://github.com/AdeAttwood/ivy.nvim ~/.config/nvim/pack/bundle/star
|
||||||
### Plugin managers
|
### Plugin managers
|
||||||
|
|
||||||
Using [lazy.nvim](https://github.com/folke/lazy.nvim)
|
Using [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
"AdeAttwood/ivy.nvim",
|
"AdeAttwood/ivy.nvim",
|
||||||
|
|
@ -28,6 +29,31 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Using [mini.deps](https://github.com/echasnovski/mini.deps)
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local deps = require "mini.deps"
|
||||||
|
deps.later(function() -- Or `deps.now` if you want this to be loaded immediately
|
||||||
|
local build = function(args)
|
||||||
|
local obj = vim
|
||||||
|
.system(
|
||||||
|
{ "cargo", "build", "--release", string.format("%s%s%s", "--manifest-path=", args.path, "/Cargo.toml") },
|
||||||
|
{ text = true }
|
||||||
|
)
|
||||||
|
:wait()
|
||||||
|
vim.print(vim.inspect(obj))
|
||||||
|
end
|
||||||
|
|
||||||
|
deps.add {
|
||||||
|
source = "AdeAttwood/ivy.nvim",
|
||||||
|
hooks = {
|
||||||
|
post_install = build,
|
||||||
|
post_checkout = build,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
TODO: Add more plugin managers
|
TODO: Add more plugin managers
|
||||||
|
|
||||||
### Setup / Configuration
|
### Setup / Configuration
|
||||||
|
|
@ -36,19 +62,19 @@ Ivy can be configured with minimal config that will give you all the defaults
|
||||||
provided by Ivy.
|
provided by Ivy.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('ivy').setup()
|
require("ivy").setup()
|
||||||
```
|
```
|
||||||
|
|
||||||
With Ivy you can configure your own backends.
|
With Ivy you can configure your own backends.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('ivy').setup {
|
require("ivy").setup {
|
||||||
backends = {
|
backends = {
|
||||||
-- A backend module that will be registered
|
-- A backend module that will be registered
|
||||||
"ivy.backends.buffers",
|
"ivy.backends.buffers",
|
||||||
-- Using a table so you can configure a custom keymap overriding the
|
-- Using a table so you can configure a custom keymap overriding the
|
||||||
-- default one.
|
-- default one.
|
||||||
{ "ivy.backends.files", { keymap = "<C-p>" } }
|
{ "ivy.backends.files", { keymap = "<C-p>" } },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -59,7 +85,7 @@ function, this can be used to load backends before or after the setup function
|
||||||
is called.
|
is called.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require('ivy').register_backend("ivy.backends.files")
|
require("ivy").register_backend "ivy.backends.files"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compiling
|
### Compiling
|
||||||
|
|
@ -117,7 +143,7 @@ customized when you register it.
|
||||||
Action can be run on selected candidates provide functionality
|
Action can be run on selected candidates provide functionality
|
||||||
|
|
||||||
| Action | Key Map | Description |
|
| Action | Key Map | Description |
|
||||||
| -------------- | ----------- | ------------------------------------------------------------------------------ |
|
| ------------------- | --------- | ---------------------------------------------------------------- |
|
||||||
| Complete | \<CR\> | Run the completion function, usually this will be opening a file |
|
| Complete | \<CR\> | Run the completion function, usually this will be opening a file |
|
||||||
| Vertical Split | \<C-v\> | Run the completion function in a new vertical split |
|
| Vertical Split | \<C-v\> | Run the completion function in a new vertical split |
|
||||||
| Split | \<C-s\> | Run the completion function in a new split |
|
| Split | \<C-s\> | Run the completion function in a new split |
|
||||||
|
|
@ -133,10 +159,14 @@ Add your own keymaps for an action by adding a `ftplugin/ivy.lua` file in your c
|
||||||
Just add a simple keymap like this:
|
Just add a simple keymap like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
vim.api.nvim_set_keymap( "n", "<esc>", "<cmd>lua vim.ivy.destroy()<CR>", { noremap = true, silent = true, nowait = true })
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<esc>",
|
||||||
|
"<cmd>lua vim.ivy.destroy()<CR>",
|
||||||
|
{ noremap = true, silent = true, nowait = true }
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
### ivy.run
|
### ivy.run
|
||||||
|
|
@ -190,7 +220,9 @@ vertical split action it will open the buffer in a new `vsplit`
|
||||||
end,
|
end,
|
||||||
-- Action callback that will be called on the completion or checkpoint actions.
|
-- Action callback that will be called on the completion or checkpoint actions.
|
||||||
-- The currently selected item is passed in as the result.
|
-- The currently selected item is passed in as the result.
|
||||||
function(result) vim.cmd("edit " .. result) end
|
function(result)
|
||||||
|
vim.cmd("edit " .. result)
|
||||||
|
end
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
local window = require "ivy.window"
|
local window = require "ivy.window"
|
||||||
local prompt = require "ivy.prompt"
|
local prompt = require "ivy.prompt"
|
||||||
|
local utils = require "ivy.utils"
|
||||||
|
|
||||||
local controller = {}
|
local controller = {}
|
||||||
|
controller.action = utils.actions
|
||||||
|
|
||||||
controller.items = nil
|
controller.items = nil
|
||||||
controller.callback = nil
|
controller.callback = nil
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,11 @@
|
||||||
local controller = require "ivy.controller"
|
local controller = require "ivy.controller"
|
||||||
local libivy = require "ivy.libivy"
|
|
||||||
local config = require "ivy.config"
|
local config = require "ivy.config"
|
||||||
local utils = require "ivy.utils"
|
|
||||||
local register_backend = require "ivy.register_backend"
|
local register_backend = require "ivy.register_backend"
|
||||||
|
|
||||||
local ivy = {}
|
local ivy = {}
|
||||||
|
|
||||||
ivy.action = utils.actions
|
|
||||||
ivy.utils = utils
|
|
||||||
|
|
||||||
ivy.match = libivy.ivy_match
|
|
||||||
|
|
||||||
ivy.run = controller.run
|
ivy.run = controller.run
|
||||||
ivy.register_backend = register_backend
|
ivy.register_backend = register_backend
|
||||||
|
|
||||||
ivy.checkpoint = controller.checkpoint
|
|
||||||
ivy.paste = controller.paste
|
|
||||||
ivy.complete = controller.complete
|
|
||||||
ivy.destroy = controller.destroy
|
|
||||||
ivy.input = controller.input
|
|
||||||
ivy.next = controller.next
|
|
||||||
ivy.previous = controller.previous
|
|
||||||
ivy.search = controller.search
|
|
||||||
|
|
||||||
-- Private variable to check if ivy has been setup, this is to prevent multiple
|
-- Private variable to check if ivy has been setup, this is to prevent multiple
|
||||||
-- setups of ivy. This is only exposed for testing purposes.
|
-- setups of ivy. This is only exposed for testing purposes.
|
||||||
---@private
|
---@private
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
local api = require "ivy"
|
local controller = require "ivy.controller"
|
||||||
|
|
||||||
-- Put the controller in to the vim global so we can access it in mappings
|
-- Put the controller in to the vim global so we can access it in mappings
|
||||||
-- better without requires. You can call controller commands like `vim.ivy.xxx`.
|
-- better without requires. You can call controller commands like `vim.ivy.xxx`.
|
||||||
-- luacheck: ignore
|
-- luacheck: ignore
|
||||||
vim.ivy = api
|
vim.ivy = controller
|
||||||
|
|
||||||
vim.paste = (function(overridden)
|
vim.paste = (function(overridden)
|
||||||
return function(lines, phase)
|
return function(lines, phase)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue