Skip to content

Commit 79079e6

Browse files
committed
update config and add httpx
1 parent c806ad1 commit 79079e6

File tree

6 files changed

+47
-111
lines changed

6 files changed

+47
-111
lines changed

config.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ require("treesitter-templ")
55
require("formatters")
66
require("autocmd.go-test")
77

8-
require("querio.execute")
98
require("chatgpt.execute")
9+
require("httpx.execute")
1010
require("template-string-converter.convert")
1111
require("run-java-test.java-test")
1212
require("transforms.json-to-ts")
@@ -36,7 +36,7 @@ lvim.plugins = {
3636
require("plugins.rust"),
3737
require("plugins.copilot"),
3838
require("plugins.autosave"),
39-
require("plugins.rest")
39+
{"BlackLight/nvim-http"}
4040
}
4141

4242

lazy-lock.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
1010
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
1111
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
12-
"copilot.vim": { "branch": "release", "commit": "dfa657c80c915a6a3eb6d9010046a0576ad25a37" },
12+
"copilot.vim": { "branch": "release", "commit": "1dcaf72099b436b5832d6117d9cd7a4a098a8d77" },
1313
"emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" },
1414
"friendly-snippets": { "branch": "main", "commit": "631f79e346b0b3203d2ce3eae619ca8d612e5463" },
1515
"gitsigns.nvim": { "branch": "main", "commit": "e5edefd9976039f5352e0c900f35206770b33a2d" },
@@ -28,11 +28,12 @@
2828
"nvim-autopairs": { "branch": "master", "commit": "7566a86f44bb72ba2b1a609f528a27d93241502d" },
2929
"nvim-cmp": { "branch": "main", "commit": "11102d3db12c7f8b35265ad0e17a21511e5b1e68" },
3030
"nvim-dap": { "branch": "master", "commit": "6cedcb527e264c8f25e86afa8dae74c6692dee51" },
31-
"nvim-dap-go": { "branch": "main", "commit": "5faf165f5062187320eaf9d177c3c1f647adc22e" },
31+
"nvim-dap-go": { "branch": "main", "commit": "a0c5a2b991d7e9304a9a032cf177e22a4b0acda1" },
3232
"nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" },
33-
"nvim-jdtls": { "branch": "master", "commit": "8eb5f0dbe6e126b392ddcaf45893358619893e45" },
33+
"nvim-http": { "branch": "main", "commit": "9a0e97b639d34af17d06b3421fe633b416dd64ee" },
34+
"nvim-jdtls": { "branch": "master", "commit": "40e8494e04c1bcd5dd6c0d0bc187d2d10965017d" },
3435
"nvim-lspconfig": { "branch": "master", "commit": "511609ae0311abfcfaed3c398429a147e895ce2c" },
35-
"nvim-surround": { "branch": "main", "commit": "6d0dc3dbb557bcc6a024969da461df4ba803fc48" },
36+
"nvim-surround": { "branch": "main", "commit": "b36bf49d097a09781ad6ac0cfea28b40b74570a3" },
3637
"nvim-tree.lua": { "branch": "master", "commit": "bb375fb20327c49920c41d2b51c1ce2f4fe7deb3" },
3738
"nvim-treesitter": { "branch": "master", "commit": "2ce3c9080cfe4a39c7907e672edafd2a95244a7c" },
3839
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
@@ -41,7 +42,6 @@
4142
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
4243
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" },
4344
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
44-
"rest.nvim": { "branch": "main", "commit": "84e81a19ab24ccf05c9233d34d4dfce61c233abe" },
4545
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
4646
"schemastore.nvim": { "branch": "main", "commit": "0b396f538f195c249f021a48c3d8988f0d3f86f7" },
4747
"structlog.nvim": { "branch": "main", "commit": "45b26a2b1036bb93c0e83f4225e85ab3cee8f476" },
@@ -50,9 +50,9 @@
5050
"templ.vim": { "branch": "main", "commit": "5cc48b93a4538adca0003c4bc27af844bb16ba24" },
5151
"toggleterm.nvim": { "branch": "main", "commit": "68fdf851c2b7901a7065ff129b77d3483419ddce" },
5252
"tokyonight.nvim": { "branch": "main", "commit": "c5df636ce62a8aab7565f35da143cfd672526302" },
53-
"vim-dadbod": { "branch": "master", "commit": "37523ffe0849b51db07fa7f48430c2aca5420a0e" },
54-
"vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" },
55-
"vim-dadbod-ui": { "branch": "master", "commit": "b1675d1f56c12b0abac2ef74b94670fe27adcf93" },
53+
"vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" },
54+
"vim-dadbod-completion": { "branch": "master", "commit": "5d5ad196fcde223509d7dabbade0148f7884c5e3" },
55+
"vim-dadbod-ui": { "branch": "master", "commit": "0dc68d9225a70d42f8645049482e090c1a8dce25" },
5656
"vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" },
5757
"vim-graphql": { "branch": "master", "commit": "c1d6af3b93ec135e7e2fc182d4cae6cd0d9e20b1" },
5858
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },

lua/httpx/execute.lua

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local M = {}
2+
3+
M.state = {}
4+
5+
M.execute = function()
6+
local curr_buf = vim.api.nvim_get_current_buf()
7+
if not M.state.bufnr or not vim.api.nvim_buf_is_valid(M.state.bufnr) then
8+
local bufnr = vim.api.nvim_create_buf(false, true)
9+
vim.api.nvim_buf_set_option(bufnr, 'buftype', 'nofile')
10+
vim.api.nvim_buf_set_option(bufnr, 'bufhidden', 'wipe')
11+
vim.api.nvim_buf_set_option(bufnr, 'swapfile', false)
12+
vim.api.nvim_buf_set_option(bufnr, 'filetype', 'json')
13+
vim.api.nvim_command("vsplit | b" .. bufnr)
14+
M.state.bufnr = bufnr
15+
end
16+
17+
local lines = vim.api.nvim_buf_get_lines(curr_buf, 0, -1, false)
18+
19+
local append_data = function(_, data, _)
20+
vim.api.nvim_buf_set_lines(M.state.bufnr, -1, -1, false, data)
21+
end
22+
23+
local jobid = vim.fn.jobstart("httpx", {
24+
stdout_buffered = false,
25+
on_stdout = append_data,
26+
on_stderr = append_data,
27+
})
28+
vim.fn.chansend(jobid, lines)
29+
vim.fn.chanclose(jobid, "stdin")
30+
end
31+
32+
33+
vim.api.nvim_create_user_command('Httpx', M.execute, { nargs = 0 })
34+
35+
return M

lua/keybinds.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ vim.cmd("autocmd FileType javascript,typescript,typescriptreact nmap <C-t>s :Jes
2929

3030
vim.cmd("autocmd FileType javascript,typescript,typescriptreact nmap <C-s>c :ConvertToTemplateString<CR>")
3131

32-
vim.cmd(":tnoremap <C-o> <C-\\><C-n>")
32+
vim.cmd(":tnoremap <ESC> <C-\\><C-n>")
3333

3434
lvim.builtin.which_key.mappings["r"] = {
3535
name = "+run",
36-
h = { "<cmd>lua require('rest-nvim').run()<CR>", "HTTP request under cursor" },
36+
h = { "<cmd>Httpx<CR>", "execute HTTP request" },
3737
s = { "<cmd>SqlExecute<CR>", "Execute the current SQL file to an active conenction" },
3838
g = { "<cmd>GptRun<CR>", "Execute the current buffer as a ChatGPT request" },
3939
c = { "<cmd>GptChat<CR>", "Open new gpt chat buffer" },

lua/plugins/rest.lua

-40
This file was deleted.

lua/querio/execute.lua

-59
This file was deleted.

0 commit comments

Comments
 (0)