Comments (14)
Switching to FZF will probably address this issue. This is the exact case I requested fzf support for
from smart-open.nvim.
No, my setup is to use this plugin for all file switching. I still use regular telescope for a few other things live grep, but they're different row types. The code to do this is in format_filepath.lua. If it's the highlighting you're after, I think that's doable through standard telescope customization, but there are a couple things like splitting the filename and shortening via ellipsis only when necessary that this plugin does in formatting that I'm pretty sure isn't pluggable on that level. But maybe the code can be adapted to your use case so have at it :-)
from smart-open.nvim.
It uses fzy (or optionally fzf) to do the matching. It's outside of the scope of this plugin to implement our own algorithm here, but if there's something I'm doing wrong with respect to plugging in the prompt text, then that's something we could change.
On the other hand if fzy/fzf just work differently in this regard, then we could see if we could add the algorithm that telescope uses as an additional option?
I'd appreciate any input or contributions from others on this one.
from smart-open.nvim.
@dtormoen Is the FZF support merged, I don't see anything in the README for how to configure it in the way you imply. All I see is that smart open
can use FZF optionally?
As a side note, I'm using the Astronvim
distro and that ships with fzf-native
, so I would assume smart open
would already be using FZF if it's an optional, automatic opt in?
https://astronvim.github.io/acknowledgements#-plugins-used-in-astronvim
Thanks to both of you for the help & advice here! 😄
from smart-open.nvim.
Yeah you configure match_algorithm = 'fzf'
. If you don't specify anything, it's treated as match_algorithm = 'fzy'
It's in the docs here: https://github.com/danielfalk/smart-open.nvim#configuration
from smart-open.nvim.
Cool, thanks @danielfalk, I must have missed that - all working as expected now, spaces are handled as I expect 👍.
Side question, is it possible to configure using the following format rather than directly in the main telescope setup - I'm not sure it's working?
require("smart_open").setup {
match_algorithm = "fzf",
}
require("telescope").load_extension "smart_open"
I recently saw this issue for another telescope extension which was also missing the above style of config.
from smart-open.nvim.
I'm not sure if there's an example of a plugin that woks that way. The one cited in the issue doesn't work that way as far as I can tell. Instead, telescope extensions are directed to provide a setup function that telescope is responsible for calling. I provide that here.
I just pushed a change however that should allow you to put it as part of your key mapping if you want to override what's configured in setup.
Example:
vim.api.nvim_set_keymap("n", "<leader><leader>", "", {
callback = function ()
require('telescope').extensions.smart_open.smart_open({ match_algorithm = "fzy" })
end,
noremap = true,
silent = true
})
from smart-open.nvim.
@danielfalk Thanks for your reply - I can't find any other addons which use this setup method, but I have a strong feeling that I've seen and used other plugins which allow this before.
However, telescope-alternate
certainly does allow that particular method - I'm using it in my config right now, for reference, here's both my telescope & telescope alternate configs.
(The nice thing about this setup method is it decouples telescope config from any addon setup & makes splitting up and managing config for telescope much cleaner).
actions = require "telescope.actions"
return {
defaults = {
mappings = {
i = {
["<CR>"] = actions.select_tab,
["<C-b>"] = actions.select_default,
["<C-_>"] = actions.select_horizontal,
["<C-Bslash>"] = actions.select_vertical,
},
},
},
extensions = {
smart_open = {
match_algorithm = "fzf",
},
},
}
require("telescope-alternate").setup {
layout_strategy = "vertical",
layout_config = {
vetical = {},
},
mappings = {
-- .... loads of stuff here
},
}
require("telescope").load_extension "telescope-alternate"
I just pushed a change however that should allow you to put it as part of your key mapping if you want to override what's configured in setup.
Thanks!
from smart-open.nvim.
OK yeah that helps. I see what they're doing and should be able to make this change
from smart-open.nvim.
I've got a new branch for this if you want to try it. It seems to work for me, but if you want to give it a shot and let me know, the branch is called alternate-setup
from smart-open.nvim.
Thanks @danielfalk, I've switched to that branch and it seems to work well!
The only weirdness is the inconsistency with the setup & telescope names (kebab vs snake casing of smart-open
), but not sure if that's a real problem or not...
return {
"danielfalk/smart-open.nvim",
dependencies = { "kkharji/sqlite.lua" },
event = "BufRead",
branch = "alternate-setup",
config = function()
require("smart-open").setup {
match_algorithm = "fzf",
}
require("telescope").load_extension "smart_open"
end,
}
See require("smart-open")
vs require("telescope").load_extension "smart_open"
from smart-open.nvim.
I'm also interested in trying out the other fixes in the 0.2
branch. Do you have plans to merge this alternate-setup
to master and back port to 0.2
?
from smart-open.nvim.
OK, it's backported now.
from smart-open.nvim.
Thanks @danielfalk - love the new results in 0.2.x - the file_name path
colouring is so much better.
I don't suppose you have a snippet to use this same highlighting by default in telescope file pickers? (figured you might have configured your setup to use this everywhere?)
from smart-open.nvim.
Related Issues (20)
- nvim cmp is trying to suggest things when I'm searching HOT 1
- Crash related to Windows directory separtor HOT 2
- match_algorithm preference list HOT 2
- Simpler mapping HOT 1
- Option to hide open buffer indicators HOT 1
- Space in search prompt HOT 2
- Feature request: Exit/close dialog on Control+C HOT 2
- Latest combination of things has no (visilbe) files listed in results view HOT 1
- Increase result limit for the number of entries HOT 2
- Can't alter mapping to open file from select_default to tab_drop or select_tab. HOT 3
- space after filename is not working (should search for folder instead filename) HOT 2
- Dropping sqlite like telescope-frecency? HOT 1
- Add ability to pass in picker options through telescope setup HOT 4
- Doesn't find history files outside working directory HOT 4
- Buffer indicators bug HOT 1
- add ability to only search history HOT 1
- Support Line Column in file pickers HOT 1
- mappings does not work HOT 3
- the file opened through smart-open is not pick up by Telescope old_files
- 5 second pause before opening HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smart-open.nvim.