From 948b03fad9196c8e0df55b47b0bb082e1ad7b068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sun, 7 Jan 2024 14:55:48 +0100 Subject: [PATCH] Noevim fzf telescope --- hypr/hyprland.conf | 2 +- hypr/hyprsome/src/main.rs | 2 +- nvim/lua/plugins.lua | 2 +- nvim/lua/settings.lua | 2 +- nvim/lua/telescope_config.lua | 19 ++++++++++++++++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 26c9d78..7220076 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -138,7 +138,7 @@ bind = $mainMod, SPACE, togglesplit, # dwindle bind = CONTROL_L ALT_L, L, exec, swaylock bind = $mainMod, C, exec, cliphist list | awk '{print $0, "\0icon\x1fcom.github.davidmhewitt.clipped"}' | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy bind = $mainMod, Y, exec, /home/user/.config/rofi/rofi-ykman.sh -bind = Super_L Control_L, Q, exec, systemctl suspend + bind = $mainMod, Escape, exec, rofi -show power-menu -modi power-menu:$scripts/rofi-power-menu bind = ,XF86PowerOff, exec, rofi -show power-menu -modi power-menu:$scripts/rofi-power-menu diff --git a/hypr/hyprsome/src/main.rs b/hypr/hyprsome/src/main.rs index 8db2946..c8f8854 100644 --- a/hypr/hyprsome/src/main.rs +++ b/hypr/hyprsome/src/main.rs @@ -11,7 +11,7 @@ use hyprland_ipc::{client, monitor, option, workspace}; #[command(name = "hyprsome")] #[command(author = "sopa0")] #[command(version = "0.1.11")] -#[command(about = "Makes hyprland workspaces behave like awesome", long_about = None)] +#[command(about = "Makes hyprland workspaces behave like awesome")] struct Cli { #[command(subcommand)] command: Commands, diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index d9949c3..6c1eeac 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -54,7 +54,7 @@ require('lazy').setup({ {'numToStr/Comment.nvim', config = function () require('Comment').setup() end}, {'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', opt = true }}, {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }, - {'nvim-telescope/telescope.nvim', dependencies = {'nvim-lua/plenary.nvim'}}, + {'nvim-telescope/telescope.nvim', dependencies = {'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-fzy-native.nvim'}}, {'nvim-tree/nvim-tree.lua', dependencies = {'nvim-tree/nvim-web-devicons'}, tag = 'nightly'}, {'nvim-treesitter/nvim-treesitter', build = ":TSUpdate"}, {'williamboman/mason-lspconfig.nvim', dependencies = {'williamboman/mason.nvim', 'neovim/nvim-lspconfig'}}, diff --git a/nvim/lua/settings.lua b/nvim/lua/settings.lua index a623c70..5bcda26 100644 --- a/nvim/lua/settings.lua +++ b/nvim/lua/settings.lua @@ -34,7 +34,7 @@ vim.g.mapleader = "," vim.g.python_highlight_all = 1 vim.wo.signcolumn = "number" vim.wo.relativenumber = true -vim.g.rooter_patterns = {".git", "Makefile", "CMakeLists.txt", "build/"} +vim.g.rooter_patterns = {".git", "Makefile", "CMakeLists.txt", "build/", "meson.build"} vim.g.rooter_silent_chdir = 1 -- Vimtex diff --git a/nvim/lua/telescope_config.lua b/nvim/lua/telescope_config.lua index f48fb34..3a12006 100644 --- a/nvim/lua/telescope_config.lua +++ b/nvim/lua/telescope_config.lua @@ -27,6 +27,15 @@ M.buffers = function() require"telescope.builtin".buffers(opts) end +M.fuzzyFindFiles = function() + require"telescope.builtin".grep_string({ + path_display = { 'smart' }, + only_sort_text = true, + word_match = "-w", + search = '', + }) +end + local actions = require("telescope.actions") require("telescope").setup{ defaults = { @@ -47,6 +56,8 @@ require("telescope").setup{ [""] = actions.move_selection_previous, }, }, + file_sorter = require'telescope.sorters'.get_fzy_sorter, + generic_sorter = require'telescope.sorters'.get_fzy_sorter, }, extensions = { undo = { @@ -64,16 +75,22 @@ require("telescope").setup{ }, } + }, + fzy_native = { + override_generic_sorter = false, + override_file_sorter = true, } } telescope.load_extension("undo") telescope.load_extension('fzf') +telescope.load_extension('fzy_native') vim.keymap.set("n", "u", function() require("telescope").extensions.undo.undo() end, {noremap = true, silent = true}) vim.keymap.set("n", "", function() require('telescope_config').git_files() end, {noremap = true, silent = true}) vim.keymap.set("n", "", function() require('telescope_config').project_files() end, { silent = true, noremap = true }) -vim.keymap.set("n", "", function() require('telescope.builtin').live_grep{ cwd = vim.fn.systemlist("git rev-parse --show-toplevel 2> /dev/null || pwd")[1] } end, { silent = true, noremap = true }) +-- vim.keymap.set("n", "", function() require('telescope.builtin').live_grep{ cwd = vim.fn.systemlist("git rev-parse --show-toplevel 2> /dev/null || pwd")[1] } end, { silent = true, noremap = true }) +vim.keymap.set("n", "", function() require('telescope_config').fuzzyFindFiles() end, { silent = true, noremap = true }) return M