kulala for nvim-treesitter-main
This commit is contained in:
parent
652cf120e0
commit
3b23a0beeb
10 changed files with 208 additions and 85 deletions
30
flake.lock
30
flake.lock
|
|
@ -241,11 +241,11 @@
|
|||
"kulala-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1764172476,
|
||||
"narHash": "sha256-rz2dynlMkxTxKzfM36vC6KMgnuJ/hj+QTXTW7NG5esY=",
|
||||
"lastModified": 1765193643,
|
||||
"narHash": "sha256-kUCu8euWmAB6wMKBP7VBb/YYwh6IkMfeyJ8zEDUm0tg=",
|
||||
"owner": "mistweaverco",
|
||||
"repo": "kulala.nvim",
|
||||
"rev": "5d3916195a97928b8f9b79d96029f37d19ba866d",
|
||||
"rev": "b36aff673915391e415d4acc7c90ca6ca6891750",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -366,11 +366,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764950072,
|
||||
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
|
||||
"lastModified": 1765186076,
|
||||
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f61125a668a320878494449750330ca58b78c557",
|
||||
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -383,11 +383,11 @@
|
|||
"nvim-treesitter": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1764266060,
|
||||
"narHash": "sha256-j2o5c4qgVYQs5DJpSDX1eMsNonDkhyhEQQYMYW2YS7o=",
|
||||
"lastModified": 1765057102,
|
||||
"narHash": "sha256-2eqOrGqOSis9vHmxe2CIxWfbf92b2iOVLxSSfoNKAw8=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"rev": "17885756e63df73ed90db62e4630f744ceda6514",
|
||||
"rev": "20db421f5fba0c23f6a7629af96ba6d4fc531677",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -406,11 +406,11 @@
|
|||
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764561751,
|
||||
"narHash": "sha256-gI/1xLdvXvrkZYTArFSW/2bydHiIJvln6sePNT4KHAc=",
|
||||
"lastModified": 1765133966,
|
||||
"narHash": "sha256-bALsLOGiMhs8uc/kgloDX/voquDA81O9AnG0bTJDWvs=",
|
||||
"owner": "iofq",
|
||||
"repo": "nvim-treesitter-main",
|
||||
"rev": "9f104282ca15b762fd6523a82ec9a6c182170489",
|
||||
"rev": "43ebb4a2f28181d15e3f7aea3e13292aa7818b63",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -422,11 +422,11 @@
|
|||
"nvim-treesitter-textobjects": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1764294350,
|
||||
"narHash": "sha256-M7Wfyg1cHXOHKzkhei3GfozK2tsUZ7LZoOdSiHY0dG4=",
|
||||
"lastModified": 1765057291,
|
||||
"narHash": "sha256-k4U3MGs01DBeb1NZDF3C8uerRAo4o+CZMhy5v3Ub1BU=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter-textobjects",
|
||||
"rev": "63c4dce4a56312ef1bdeafd16bdefa008fcc950a",
|
||||
"rev": "76deedf0f1cec4496ef8d49b6d1f020f6d0c6ec9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
let
|
||||
system = pkgs.system;
|
||||
fmt = inputs.kulala-fmt.packages.${system}.default;
|
||||
kulala-nvim = inputs.kulala-nvim;
|
||||
in
|
||||
{
|
||||
grammar = pkgs.tree-sitter.buildGrammar {
|
||||
language = "kulala_http";
|
||||
version = kulala-nvim.lastModifiedDate;
|
||||
src = kulala-nvim;
|
||||
location = "lua/tree-sitter";
|
||||
};
|
||||
nvim = pkgs.vimPlugins.kulala-nvim.overrideAttrs (oa: {
|
||||
version = kulala-nvim.lastModifiedDate;
|
||||
src = kulala-nvim;
|
||||
});
|
||||
inherit fmt;
|
||||
}
|
||||
|
|
@ -1,15 +1,14 @@
|
|||
{ inputs, pkgs, lib, mkNvimPlugin, ... }:
|
||||
let
|
||||
kulala = pkgs.callPackage ../kulala.nix { inherit pkgs inputs; };
|
||||
in
|
||||
{
|
||||
packages = [
|
||||
# kulala.fmt
|
||||
pkgs.kulala-fmt
|
||||
pkgs.websocat
|
||||
pkgs.grpcurl
|
||||
pkgs.prettier
|
||||
pkgs.libxml2
|
||||
];
|
||||
|
||||
plugins = [
|
||||
# kulala.nvim
|
||||
pkgs.vimPlugins.kulala-nvim
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,47 +308,70 @@ with final.pkgs.lib; let
|
|||
pkgs.fixjson
|
||||
pkgs.codespell
|
||||
];
|
||||
|
||||
in
|
||||
rec
|
||||
{
|
||||
tree-sitter-kulala-http = prev.tree-sitter.buildGrammar
|
||||
{
|
||||
passthru.name = "kulala_http";
|
||||
language = "kulala_http";
|
||||
version = inputs.kulala-nvim.lastModifiedDate;
|
||||
src = inputs.kulala-nvim;
|
||||
location = "lua/tree-sitter";
|
||||
};
|
||||
kulala-fmt = inputs.kulala-fmt.packages.${prev.system}.default;
|
||||
|
||||
vimPlugins = prev.vimPlugins.extend
|
||||
(
|
||||
f: p: {
|
||||
nvim-treesitter = (p.nvim-treesitter.withPlugins (_: [ tree-sitter-kulala-http ] ++ p.nvim-treesitter.allGrammars))
|
||||
.overrideAttrs (old: {
|
||||
postInstall = old.postInstall + ''
|
||||
ln -sfT ${tree-sitter-kulala-http}/queries/kulala_http $out/queries/kulala_http
|
||||
'';
|
||||
});
|
||||
|
||||
vimPlugins = prev.vimPlugins.extend (
|
||||
f: p: {
|
||||
nvim-treesitter = p.nvim-treesitter.withAllGrammars;
|
||||
nvim-treesitter-textobjects = p.nvim-treesitter-textobjects.overrideAttrs {
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
|
||||
hlargs-nvim = (mkNvimPlugin inputs.hlargs-nvim "hlargs.nvim").overrideAttrs
|
||||
{
|
||||
kulala-nvim = p.kulala-nvim.overrideAttrs {
|
||||
version = inputs.kulala-nvim.lastModifiedDate;
|
||||
src = inputs.kulala-nvim;
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
nvim-treesitter-textobjects = p.nvim-treesitter-textobjects.overrideAttrs {
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
|
||||
nvim-treesitter-context = p.nvim-treesitter-context.overrideAttrs
|
||||
{
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
hlargs-nvim = (mkNvimPlugin inputs.hlargs-nvim "hlargs.nvim").overrideAttrs
|
||||
{
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
|
||||
cmp-diag-codes = (mkNvimPlugin inputs.cmp-diag-codes "cmp-diag-codes");
|
||||
nvim-treesitter-context = p.nvim-treesitter-context.overrideAttrs
|
||||
{
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
|
||||
yaml-nvim = (mkNvimPlugin inputs.yaml-nvim "yaml.nvim");
|
||||
gentags = (mkNvimPlugin inputs.gentags-lua "gentags.lua").overrideAttrs
|
||||
{
|
||||
dependencies = [ prev.vimPlugins.plenary-nvim ];
|
||||
};
|
||||
cmp-diag-codes = (mkNvimPlugin inputs.cmp-diag-codes "cmp-diag-codes");
|
||||
|
||||
namu-nvim = (mkNvimPlugin inputs.namu-nvim "namu.nvim");
|
||||
yaml-nvim = (mkNvimPlugin inputs.yaml-nvim "yaml.nvim");
|
||||
gentags = (mkNvimPlugin inputs.gentags-lua "gentags.lua").overrideAttrs
|
||||
{
|
||||
dependencies = [ prev.vimPlugins.plenary-nvim ];
|
||||
};
|
||||
|
||||
stayinpalce = (mkNvimPlugin inputs.stay-in-place-nvim "stay-in-place.nvim");
|
||||
namu-nvim = (mkNvimPlugin inputs.namu-nvim "namu.nvim");
|
||||
|
||||
smart-splits-nvim = (mkNvimPluginNoCheck inputs.smart-splits-nvim "smart-splits.nvim");
|
||||
stayinpalce = (mkNvimPlugin inputs.stay-in-place-nvim "stay-in-place.nvim");
|
||||
|
||||
local-highlight-nvim = (mkNvimPlugin inputs.local-highlight-nvim "local-highlight.nvim");
|
||||
whatthejump-nvim = (mkNvimPlugin inputs.whatthejump-nvim "whatthejump.nvim");
|
||||
smart-splits-nvim = (mkNvimPluginNoCheck inputs.smart-splits-nvim "smart-splits.nvim");
|
||||
|
||||
nvim-window = (mkNvimPlugin inputs.nvim-window "nvim-window");
|
||||
}
|
||||
);
|
||||
local-highlight-nvim = (mkNvimPlugin inputs.local-highlight-nvim "local-highlight.nvim");
|
||||
whatthejump-nvim = (mkNvimPlugin inputs.whatthejump-nvim "whatthejump.nvim");
|
||||
|
||||
nvim-window = (mkNvimPlugin inputs.nvim-window "nvim-window");
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
codingPackages = pkgs.buildEnv {
|
||||
name = "coding-packages";
|
||||
|
|
|
|||
|
|
@ -223,3 +223,14 @@ fn.augroup("after ui", {
|
|||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufHidden", {
|
||||
desc = "Delete [No Name] buffers",
|
||||
callback = function(data)
|
||||
if data.file == "" and vim.bo[data.buf].buftype == "" and not vim.bo[data.buf].modified then
|
||||
vim.schedule(function()
|
||||
pcall(vim.api.nvim_buf_delete, data.buf, {})
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,8 +8,100 @@ lze.load({
|
|||
ft = { "http", "rest" },
|
||||
after = function()
|
||||
require("kulala").setup({
|
||||
global_keymaps_prefix = "<leader>h",
|
||||
kulala_keymaps_prefix = "<leader>k",
|
||||
ui = {
|
||||
default_winbar_panes = {
|
||||
"headers_body",
|
||||
"verbose",
|
||||
"script_output",
|
||||
"stats",
|
||||
"report",
|
||||
},
|
||||
},
|
||||
contenttypes = {
|
||||
["application/json"] = {
|
||||
ft = "json",
|
||||
formatter = vim.fn.executable("jaq") == 1 and { "jaq", "." },
|
||||
pathresolver = function(...)
|
||||
return require("kulala.parser.jsonpath").parse(...)
|
||||
end,
|
||||
},
|
||||
["application/graphql-response+json"] = "application/json",
|
||||
["application/graphql"] = {
|
||||
ft = "graphql",
|
||||
formatter = vim.fn.executable("prettier") == 1
|
||||
and { "prettier", "--stdin-filepath", "graphql", "--parser", "graphql" },
|
||||
pathresolver = nil,
|
||||
},
|
||||
["application/xml"] = {
|
||||
ft = "xml",
|
||||
formatter = vim.fn.executable("xmllint") == 1 and { "xmllint", "--format", "-" },
|
||||
pathresolver = vim.fn.executable("xmllint") == 1 and { "xmllint", "--xpath", "{{path}}", "-" },
|
||||
},
|
||||
["text/html"] = {
|
||||
ft = "html",
|
||||
formatter = vim.fn.executable("xmllint") == 1 and { "xmllint", "--format", "--html", "-" },
|
||||
pathresolver = nil,
|
||||
},
|
||||
},
|
||||
|
||||
-- stylua: ignore start
|
||||
global_keymaps = {
|
||||
["Open scratchpad"] = { "<leader>hb", function() require("kulala").scratchpad() end, },
|
||||
["Open kulala"] = { "<leader>ho", function() require("kulala").open() end, },
|
||||
|
||||
["Show headers/body"] = { "<leader>ht", function() require("kulala.ui").show_headers_body() end, ft = { "http", "rest" }, },
|
||||
["Show stats"] = { "<leader>hS", function() require("kulala").show_stats() end, ft = { "http", "rest" }, },
|
||||
|
||||
["Close window"] = { "q", function() require("kulala").close() end, ft = { "http", "rest" }, },
|
||||
|
||||
["Copy as cURL"] = { "<leader>hc", function() require("kulala").copy() end, ft = { "http", "rest" }, },
|
||||
["Paste from curl"] = { "<leader>hC", function() require("kulala").from_curl() end, ft = { "http", "rest" }, },
|
||||
|
||||
["Send request"] = { "<leader>hs", function() require("kulala").run() end, mode = { "n", "v" }, },
|
||||
["Send request <cr>"] = { "<CR>", function() require("kulala").run() end, mode = { "n", "v" }, ft = { "http", "rest" }, },
|
||||
["Send all requests"] = { "<leader>ha", function() require("kulala").run_all() end, mode = { "n", "v" }, },
|
||||
|
||||
["Inspect current request"] = { "<leader>hi", function() require("kulala").inspect() end, ft = { "http", "rest" } },
|
||||
["Open cookies jar"] = { "<leader>hj", function() require("kulala").open_cookies_jar() end, ft = { "http", "rest" } },
|
||||
["Replay the last request"] = { "<leader>hr", function() require("kulala").replay() end, },
|
||||
|
||||
["Find request"] = { "<leader>hf", function() require("kulala").search() end, ft = { "http", "rest" }, },
|
||||
["Jump to next request"] = { "]h", function() require("kulala").jump_next() end, ft = { "http", "rest" }, },
|
||||
["Jump to previous request"] = { "[h", function() require("kulala").jump_prev() end, ft = { "http", "rest" }, },
|
||||
|
||||
["Select environment"] = { "<leader>he", function() require("kulala").set_selected_env() end, ft = { "http", "rest" }, },
|
||||
["Manage Auth Config"] = { "<leader>hu", function() require("lua.kulala.ui.auth_manager").open_auth_config() end, ft = { "http", "rest" }, },
|
||||
["Download GraphQL schema"] = { "<leader>hg", function() require("kulala").download_graphql_schema() end, ft = { "http", "rest" }, },
|
||||
|
||||
["Clear globals"] = { "<leader>hx", function() require("kulala").scripts_clear_global() end, ft = { "http", "rest" }},
|
||||
["Clear cached files"] = { "<leader>hX", function() require("kulala").clear_cached_files() end, ft = { "http", "rest" }, },
|
||||
},
|
||||
|
||||
kulala_keymaps = {
|
||||
["Show headers and body"] = { "A", function() require("kulala.ui").show_headers_body() end, },
|
||||
["Show verbose"] = { "V", function() require("kulala.ui").show_verbose() end, },
|
||||
|
||||
["Show script output"] = { "O", function() require("kulala.ui").show_script_output() end, },
|
||||
["Show stats"] = { "S", function() require("kulala.ui").show_stats() end, },
|
||||
["Show report"] = { "R", function() require("kulala.ui").show_report() end, },
|
||||
["Show filter"] = { "F", function() require("kulala.ui").toggle_filter() end },
|
||||
|
||||
["Send WS message"] = { "<S-CR>", function() require("kulala.cmd.websocket").send() end, mode = { "n", "v" }, },
|
||||
["Interrupt requests"] = { "<C-c>", function() require("kulala.cmd.websocket").close() end, desc = "also: CLose WS connection" },
|
||||
|
||||
["Next response"] = { "]", function() require("kulala.ui").show_next() end, },
|
||||
["Previous response"] = { "[", function() require("kulala.ui").show_previous() end, },
|
||||
["Jump to response"] = { "<CR>", function() require("kulala.ui").jump_to_response() end, desc = "also: Send WS message for WS connections" },
|
||||
|
||||
["Clear responses history"] = { "X", function() require("kulala.ui").clear_responses_history() end, },
|
||||
|
||||
["Show help"] = { "?", function() require("kulala.ui").show_help() end, },
|
||||
["Show news"] = { "g?", function() require("kulala.ui").show_news() end, },
|
||||
|
||||
["Toggle split/float"] = { "|", function() require("kulala.ui").toggle_display_mode() end, prefix = false, },
|
||||
["Close"] = { "q", function() require("kulala.ui").close_kulala_buffer() end, },
|
||||
},
|
||||
-- stylua: ignore end
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -99,3 +99,6 @@ vim.keymap.set(
|
|||
end)(),
|
||||
{ desc = "Toggle autoresize height width buffers of window" }
|
||||
)
|
||||
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
|
||||
vim.keymap.set({ "n", "x", "o" }, "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
vim.keymap.set({ "n", "x", "o" }, "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||
|
|
|
|||
|
|
@ -25,15 +25,21 @@ misc.setup_restore_cursor({
|
|||
ignore_filetype = { "largefile", "gitcommit", "gitrebase", "svn", "hgcommit" },
|
||||
})
|
||||
|
||||
misc.setup_termbg_sync()
|
||||
|
||||
lze.load({
|
||||
{
|
||||
"mini.ai",
|
||||
event = "ModeChanged",
|
||||
after = function()
|
||||
require("mini.ai").setup({
|
||||
local ai = require("mini.ai")
|
||||
|
||||
ai.setup({
|
||||
-- Table with textobject id as fields, textobject specification as values.
|
||||
-- Also use this to disable builtin textobjects. See |MiniAi.config|.
|
||||
custom_textobjects = nil,
|
||||
custom_textobjects = {
|
||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }),
|
||||
},
|
||||
|
||||
-- Module mappings. Use `''` (empty string) to disable one.
|
||||
mappings = {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,33 @@
|
|||
###
|
||||
# this is a valid in-place variable syntax
|
||||
@myhost = httpbin.org
|
||||
|
||||
###
|
||||
|
||||
###
|
||||
|
||||
# get ip
|
||||
GET https://jmarkin.ru/ip
|
||||
|
||||
###
|
||||
GET https://{{myhost}}/json
|
||||
|
||||
###
|
||||
GET https://{{myhost}}/uuid
|
||||
GET https://jmarkin.ru/ip HTTP/1.1
|
||||
|
||||
|
||||
###
|
||||
GET https://{{myhost}}/html
|
||||
###
|
||||
|
||||
###
|
||||
GET ya.ru
|
||||
GET https://{{myhost}}/json HTTP/1.1
|
||||
|
||||
|
||||
###
|
||||
|
||||
###
|
||||
GET https://{{myhost}}/uuid HTTP/1.1
|
||||
|
||||
GET http://example.com
|
||||
|
||||
###
|
||||
|
||||
GET https://{{myhost}}/html HTTP/1.1
|
||||
|
||||
|
||||
###
|
||||
|
||||
GET ya.ru HTTP/1.1
|
||||
|
||||
|
||||
###
|
||||
|
||||
GET http://example.com HTTP/1.1
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
###
|
||||
@ollama = http://192.168.88.15:11434
|
||||
|
||||
### generate
|
||||
|
|
|
|||
Loading…
Reference in a new issue