Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moevis/smartjump.nvim
Advanced 'gf' command for neovim
https://github.com/moevis/smartjump.nvim
Last synced: 3 days ago
JSON representation
Advanced 'gf' command for neovim
- Host: GitHub
- URL: https://github.com/moevis/smartjump.nvim
- Owner: moevis
- License: mit
- Created: 2022-06-14T19:08:03.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T17:55:22.000Z (over 2 years ago)
- Last Synced: 2024-08-02T13:33:51.194Z (3 months ago)
- Language: Lua
- Size: 7.81 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# smartjump.nvim
Advanced `gf` command for neovim.
`smartjump.nvim` will lookup the filename under the cursor in `vim.o.path`.
## Screenshot
There are several `main.go` file in the project, smartjump will find it in all folders defined by `path` variable, and show them with line number awareness.
![smartjump](https://user-images.githubusercontent.com/3747445/173917178-22eabbd8-4f07-4e76-98c9-ba4528c0e243.gif)
## Installation and Setup
Using packer:
```lua
use {"moevis/smartjump.nvim", requires = "nvim-telescope/telescope.nvim"}
```Default setup (optional):
```lua
require("smartjump").setup({
-- telescope config
telescope = {
prompt_title = "Go To File",
},
-- or require("telescope.themes").get_dropdown()/.get_ivy()/.get_cursor()
theme = nil,
})
```Set keymap (by lua):
```lua
-- maping to 'gl'
vim.keymap.set("n", "gl", ":GoToFile", nil)-- or you can replace default 'gf' command
vim.keymap.set("n", "gf", ":GoToFile", nil)
```## Command and Setup
Key mapping (Telescope default behaviors):
- ``: open the file in current buffer.
- ``: open the file in new tab.
- ``: open file in horizontal window.
- ``: open file in vertical window.## Tips
You can define a custom `vim.o.path` for your project by adding a local `.vimrc` in your project root.
```vimscript
set path=/usr/include,/usr/local/include
```And remember add these lines in your init.vim:
```vimscript
set exrc " equal to vim.opt.exrc = true
set secure " equal to vim.opt.secure = true
```