Skip to content

Commit

Permalink
terminal/editors/neovim: __raw lua hints
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jun 4, 2024
1 parent 44d4c12 commit fcd1ed7
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 47 deletions.
22 changes: 19 additions & 3 deletions modules/home/programs/terminal/editors/neovim/plugins/ccc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ _: {
filetypes = [ "colorPickerFts" ];
};
pickers = [
# Lua
''require("ccc").picker.hex''
# Lua
''require("ccc").picker.css_rgb''
# Lua
''require("ccc").picker.css_hsl''
# Lua
''
require("ccc").picker.ansi_escape {
meaning1 = "bright"
Expand All @@ -26,28 +30,40 @@ _: {
};
inputs = [ "require('ccc').input.hsl" ];
outputs = [
# Lua
"require('ccc').output.css_hsl"
# Lua
"require('ccc').output.css_rgb"
# Lua
"require('ccc').output.hex"
];
convert = [
[
# Lua
"require('ccc').picker.hex"
# Lua
"require('ccc').output.css_hsl"
]
[
# Lua
"require('ccc').picker.css_rgb"
# Lua
"require('ccc').output.css_hsl"
]
[
# Lua
"require('ccc').picker.css_hsl"
# Lua
"require('ccc').output.hex"
]
];
mappings = {
"q".__raw = "require('ccc').mapping.quit";
"L".__raw = "require('ccc').mapping.increase10";
"H".__raw = "require('ccc').mapping.decrease10";
q.__raw = # Lua
"require('ccc').mapping.quit";
L.__raw = # Lua
"require('ccc').mapping.increase10";
H.__raw = # Lua
"require('ccc').mapping.decrease10";
};
};
};
Expand Down
30 changes: 16 additions & 14 deletions modules/home/programs/terminal/editors/neovim/plugins/gitsigns.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ in
{
mode = "n";
key = "<leader>ghp";
action.__raw = ''
function()
if vim.wo.diff then return ${toJSON "<leader>gp"} end
action.__raw = # Lua
''
function()
if vim.wo.diff then return ${toJSON "<leader>gp"} end
vim.schedule(function() require("gitsigns").prev_hunk() end)
vim.schedule(function() require("gitsigns").prev_hunk() end)
return '<Ignore>'
end
'';
return '<Ignore>'
end
'';
options = {
desc = "Previous hunk";
silent = true;
Expand All @@ -124,15 +125,16 @@ in
{
mode = "n";
key = "<leader>ghn";
action.__raw = ''
function()
if vim.wo.diff then return ${toJSON "<leader>gn"} end
action.__raw = # Lua
''
function()
if vim.wo.diff then return ${toJSON "<leader>gn"} end
vim.schedule(function() require("gitsigns").next_hunk() end)
vim.schedule(function() require("gitsigns").next_hunk() end)
return '<Ignore>'
end
'';
return '<Ignore>'
end
'';
options = {
desc = "Next hunk";
silent = true;
Expand Down
64 changes: 34 additions & 30 deletions modules/home/programs/terminal/editors/neovim/plugins/hop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,52 @@
keymaps = lib.optionals config.programs.nixvim.plugins.hop.enable [
{
key = "f";
action.__raw = ''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
})
end
'';
action.__raw = # Lua
''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
})
end
'';
options.remap = true;
}
{
key = "F";
action.__raw = ''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
})
end
'';
action.__raw = # Lua
''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
})
end
'';
options.remap = true;
}
{
key = "t";
action.__raw = ''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
hint_offset = -1
})
end
'';
action.__raw = # Lua
''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
hint_offset = -1
})
end
'';
options.remap = true;
}
{
key = "T";
action.__raw = ''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
hint_offset = 1
})
end
'';
action.__raw = # Lua
''
function()
require'hop'.hint_char1({
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
hint_offset = 1
})
end
'';
options.remap = true;
}
];
Expand Down

0 comments on commit fcd1ed7

Please sign in to comment.