Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiyoon/telescope-insert-path.nvim
Insert file path on the current buffer using Telescope.nvim
https://github.com/kiyoon/telescope-insert-path.nvim
neovim neovim-plugin nvim nvim-plugin telescope telescope-extension telescope-plugin
Last synced: 19 days ago
JSON representation
Insert file path on the current buffer using Telescope.nvim
- Host: GitHub
- URL: https://github.com/kiyoon/telescope-insert-path.nvim
- Owner: kiyoon
- License: mit
- Created: 2022-12-10T17:02:06.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-31T10:12:44.000Z (over 1 year ago)
- Last Synced: 2024-10-12T15:54:22.213Z (about 1 month ago)
- Topics: neovim, neovim-plugin, nvim, nvim-plugin, telescope, telescope-extension, telescope-plugin
- Language: Lua
- Homepage:
- Size: 29.3 KB
- Stars: 32
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telescope-insert-path.nvim
Set of [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) actions to insert file path on the current buffer.
### Supported Path Types
- Absolute path
- Relative path (to current working directory)
- Relative path (to buffer file)
- Relative to git root
- Relative to custom source direcotry### Custom source directory
The custom source directory can be set using the method `require('telescope_insert_path').set_source_dir()`.A default custom source directory can be set using the global option `telescope_insert_path_source_dir`.
In the case this option is set and present in the root of the project (git root or cwd) this will be used,
if the value does not exists or it's not a directory the root of the project will be used as default.### Supported Insert Locations
- `i`: before cursor
- `a`: after cursor
- `I`: beginning of the line
- `A`: end of the line
- `o`: new line after
- `O`: new line before### Supported Vim Modes after Insertion
You can configure it to be in these three modes after insertion:
- Insert
- Normal
- Visual mode with the path selected### Supported Telescope Modes
- Multiple selections
- Any modes (Find files, Live grep, ...)## Installation
Install using vim-plug:
```vim
Plug 'kiyoon/telescope-insert-path.nvim'
```Install using packer:
```lua
use {'kiyoon/telescope-insert-path.nvim'}
```Setup telescope with path actions in vimscript / lua:
```lua
local path_actions = require('telescope_insert_path')require('telescope').setup {
defaults = {
mappings = {
n = {
-- E.g. Type `[i`, `[I`, `[a`, `[A`, `[o`, `[O` to insert relative path and select the path in visual mode.
-- Other mappings work the same way with a different prefix.
["["] = path_actions.insert_reltobufpath_visual,
["]"] = path_actions.insert_abspath_visual,
["{"] = path_actions.insert_reltobufpath_insert,
["}"] = path_actions.insert_abspath_insert,
["-"] = path_actions.insert_reltobufpath_normal,
["="] = path_actions.insert_abspath_normal,
-- If you want to get relative path that is relative to the cwd, use
-- `relpath` instead of `reltobufpath`
-- You can skip the location postfix if you specify that in the function name.
-- [""] = path_actions.insert_relpath_o_visual,
}
}
}
}
```