mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-04-01 01:47:25 +02:00
work: Allow to insert reviewer with telescope
This commit is contained in:
parent
96de067813
commit
d5b48dbb31
2 changed files with 51 additions and 0 deletions
42
hostconfig/thinkpad-nixos/telescope-team.lua
Normal file
42
hostconfig/thinkpad-nixos/telescope-team.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local team_picker = function(opts)
|
||||
opts = opts or {}
|
||||
return pickers
|
||||
.new(opts, {
|
||||
prompt_title = "Team member",
|
||||
finder = finders.new_table({
|
||||
results = {
|
||||
[[Quentin Boyer "<quentin.boyer@***REMOVED***>"]],
|
||||
[[Mathieu Barbe "<mathieu.barbe@***REMOVED***>"]],
|
||||
[[Philippe Dutrueux "<philippe.dutrueux@***REMOVED***>"]],
|
||||
[[Sylvain Goudeau "<sylvain.goudeau@***REMOVED***>"]],
|
||||
[[Jonathan Espié--Caullet "<jonathan.espiecaullet@***REMOVED***>"]],
|
||||
[[Damien Bergamini "<damien.bergamini@***REMOVED***>"]],
|
||||
[[Pedro Martins Basso "<pedro.martinsbasso@***REMOVED***>"]],
|
||||
[[Yoann Heitz "<yoann.heitz@***REMOVED***>"]],
|
||||
},
|
||||
}),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr, map)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
vim.api.nvim_put({ selection[1] }, "", false, true)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
return function()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local member = team_picker()
|
||||
|
||||
vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { member })
|
||||
end
|
||||
|
|
@ -12,6 +12,15 @@
|
|||
config = {
|
||||
workAddr = "quentin.boyer@***REMOVED***";
|
||||
|
||||
extraNixvim = {
|
||||
extraConfigLuaPre = ''
|
||||
team_picker = dofile("${./telescope-team.lua}")
|
||||
'';
|
||||
commands = {
|
||||
Review = "lua team_picker()";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "nwadminSendmail" ''
|
||||
#!/usr/bin/env sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue