[nvim] autopairs bs map and harpoon and tpipeline fix

This commit is contained in:
Afonso Franco 2024-05-01 18:52:16 +01:00
parent 122016b699
commit 246add33ec
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
7 changed files with 158 additions and 24 deletions

View file

@ -1,8 +1,8 @@
{
"LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
"ale": { "branch": "master", "commit": "6db58b33795430a6165f27c7f796c420c0e098e4" },
"LuaSnip": { "branch": "master", "commit": "8f3d3465ba5c7ade0a8adb41eca5736f291a3fa8" },
"ale": { "branch": "master", "commit": "d19b238aa2d7c426e71c5de083bd61328d5c4fd4" },
"catppuccin": { "branch": "main", "commit": "a1439ad7c584efb3d0ce14ccb835967f030450fe" },
"cinnamon.nvim": { "branch": "master", "commit": "559fe02fae00ffd78377e9c242b2faa25a428592" },
"cinnamon.nvim": { "branch": "master", "commit": "a011e84b624cd7b609ea928237505d31b987748a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
@ -10,54 +10,55 @@
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" },
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
"conform.nvim": { "branch": "master", "commit": "4660e534bf7678ee0f85879aa75fdcb6855612c2" },
"dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" },
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"fzf": { "branch": "master", "commit": "d8bfb6712d514fd6715135fd0e60df188831b566" },
"fzf": { "branch": "master", "commit": "4a68eac99bb3814f912d236fa9356516ebda2fa5" },
"gruvbox-material": { "branch": "master", "commit": "80331fbbec9ba18590a17bc6b7d277d96c05c2b6" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" },
"instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" },
"jq.nvim": { "branch": "master", "commit": "b9879798f25a9318894456dc7464af0904c08958" },
"keylab.nvim": { "branch": "main", "commit": "9686b09253b5dde40e18554d189deb1b0c47f437" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"ltex-extra.nvim": { "branch": "master", "commit": "4296c2c7aefbca721d02a011366a1de30598046c" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-bqf": { "branch": "main", "commit": "52703d7adc3be3f7c09eea9a80c5b8caa615fb25" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
"nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
"nvim-dap-go": { "branch": "main", "commit": "36abe1d320cb61bfdf094d4e0fe815ef58f2302a" },
"nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
"nvim-ghost.nvim": { "branch": "main", "commit": "a1ca0b2dac59881066d7ac9373cf64d59ba29d6a" },
"nvim-lspconfig": { "branch": "master", "commit": "9266dc26862d8f3556c2ca77602e811472b4c5b8" },
"nvim-lspconfig": { "branch": "master", "commit": "7133e85c3df14a387da8942c094c7edddcdef309" },
"nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" },
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
"nvim-treesitter": { "branch": "master", "commit": "2a95ff14764af20d32ec1edb27e11c38a84b9478" },
"nvim-treesitter-context": { "branch": "master", "commit": "ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1" },
"nvim-treesitter": { "branch": "master", "commit": "0883ff05655117a3fc79ab295a640c4984cfd415" },
"nvim-treesitter-context": { "branch": "master", "commit": "4fe0a54e86859744968e1a5c7867b49c86855774" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
"nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" },
"oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
"nvim-web-devicons": { "branch": "master", "commit": "beb6367ab8496c9e43f22e0252735fdadae1872d" },
"oil.nvim": { "branch": "master", "commit": "f3a31eba24587bc038592103d8f7e64648292115" },
"pastify.nvim": { "branch": "main", "commit": "47317b9bb7bf5fb7dfd994a6eb9bec8f00628dc0" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
"tla.nvim": { "branch": "master", "commit": "e419c75e805ab6d9967c7325bf35734c372d3d4b" },
"todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
"vim-alloy": { "branch": "master", "commit": "5bd57c4890be39e221dd3e1f6735457dce454bbd" },
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" },
"vim-jukit": { "branch": "master", "commit": "73214c9a8abc4b6aa7a6266b5bc2ddbf8b3e3c00" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-tpipeline": { "branch": "master", "commit": "5dd3832bd6e239feccb11cadca583cdcf9d5bda1" },
"vimtex": { "branch": "master", "commit": "ac0a41b297a70c101df89bc9c8d43341ba00fd4f" },
"vimtex": { "branch": "master", "commit": "6c01660a99c0cc0906b39094f4a2d086b28fa995" },
"zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
}

View file

@ -3,7 +3,7 @@ local npairs = require('nvim-autopairs')
npairs.setup({
map_cr = true,
map_bs = false,
map_bs = true,
check_ts = true,
enable_check_bracket_line = true,
ignored_next_char = "[%w]"

View file

@ -0,0 +1,13 @@
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)

View file

@ -29,6 +29,13 @@ lazy.setup({
end,
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
@ -38,7 +45,12 @@ lazy.setup({
end
},
"vimpostor/vim-tpipeline",
{
"vimpostor/vim-tpipeline",
config = function()
vim.g.tpipeline_restore = 1
end
},
{
"TobinPalmer/pastify.nvim",

View file

@ -12,7 +12,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
vim.opt_local.signcolumn=numbers
vim.opt_local.signcolumn = numbers
local telescope = require("telescope.builtin")
local conform = require("conform")
@ -106,6 +106,11 @@ mason_lspconfig.setup_handlers({
-- rest of your on_attach process.
require("ltex_extra").setup()
end,
settings = {
ltex = {
language = "en-US",
},
},
})
end,
["basedpyright"] = function()

View file

@ -13,10 +13,10 @@ telescope.setup {
pickers = {
find_files = {
previewer = false,
layout_strategy = "vertical",
layout_config = {
layout_strategy = "center",
layout_config = {
height = 0.7,
width = 0.5
width = 0.5
},
},
live_grep = {

View file

@ -0,0 +1,103 @@
; extends
; inject sql in single line strings
; e.g. db.GetContext(ctx, "SELECT * FROM users WHERE name = 'John'")
((call_expression
(selector_expression
field: (field_identifier) @_field)
(argument_list
(interpreted_string_literal) @sql))
(#any-of? @_field "Exec" "GetContext" "ExecContext" "SelectContext" "In"
"RebindNamed" "Rebind" "Query" "QueryRow" "QueryRowxContext" "NamedExec" "MustExec" "Get" "Queryx")
(#offset! @sql 0 1 0 -1))
; still buggy for nvim 0.10
((call_expression
(selector_expression
field: (field_identifier) @_field (#any-of? @_field "Exec" "GetContext" "ExecContext" "SelectContext" "In" "RebindNamed" "Rebind" "Query" "QueryRow" "QueryRowxContext" "NamedExec" "MustExec" "Get" "Queryx"))
(argument_list
(interpreted_string_literal) @injection.content))
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "sql"))
; neovim nightly 0.10
([
(interpreted_string_literal)
(raw_string_literal)
] @injection.content
(#match? @injection.content "(SELECT|select|INSERT|insert|UPDATE|update|DELETE|delete).+(FROM|from|INTO|into|VALUES|values|SET|set).*(WHERE|where|GROUP BY|group by)?")
(#set! injection.language "sql"))
; a general query injection
([
(interpreted_string_literal)
(raw_string_literal)
] @sql
(#match? @sql "(SELECT|select|INSERT|insert|UPDATE|update|DELETE|delete).+(FROM|from|INTO|into|VALUES|values|SET|set).*(WHERE|where|GROUP BY|group by)?")
(#offset! @sql 0 1 0 -1))
; ----------------------------------------------------------------
; fallback keyword and comment based injection
([
(interpreted_string_literal)
(raw_string_literal)
] @sql
(#contains? @sql "-- sql" "--sql" "ADD CONSTRAINT" "ALTER TABLE" "ALTER COLUMN"
"DATABASE" "FOREIGN KEY" "GROUP BY" "HAVING" "CREATE INDEX" "INSERT INTO"
"NOT NULL" "PRIMARY KEY" "UPDATE SET" "TRUNCATE TABLE" "LEFT JOIN" "add constraint" "alter table" "alter column" "database" "foreign key" "group by" "having" "create index" "insert into"
"not null" "primary key" "update set" "truncate table" "left join")
(#offset! @sql 0 1 0 -1))
; nvim 0.10
([
(interpreted_string_literal)
(raw_string_literal)
] @injection.content
(#contains? @injection.content "-- sql" "--sql" "ADD CONSTRAINT" "ALTER TABLE" "ALTER COLUMN"
"DATABASE" "FOREIGN KEY" "GROUP BY" "HAVING" "CREATE INDEX" "INSERT INTO"
"NOT NULL" "PRIMARY KEY" "UPDATE SET" "TRUNCATE TABLE" "LEFT JOIN" "add constraint" "alter table" "alter column" "database" "foreign key" "group by" "having" "create index" "insert into"
"not null" "primary key" "update set" "truncate table" "left join")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "sql"))
; should I use a more exhaustive list of keywords?
; "ADD" "ADD CONSTRAINT" "ALL" "ALTER" "AND" "ASC" "COLUMN" "CONSTRAINT" "CREATE" "DATABASE" "DELETE" "DESC" "DISTINCT" "DROP" "EXISTS" "FOREIGN KEY" "FROM" "JOIN" "GROUP BY" "HAVING" "IN" "INDEX" "INSERT INTO" "LIKE" "LIMIT" "NOT" "NOT NULL" "OR" "ORDER BY" "PRIMARY KEY" "SELECT" "SET" "TABLE" "TRUNCATE TABLE" "UNION" "UNIQUE" "UPDATE" "VALUES" "WHERE"
; json
((const_spec
name: (identifier) @_const
value: (expression_list (raw_string_literal) @json))
(#lua-match? @_const ".*[J|j]son.*"))
; jsonStr := `{"foo": "bar"}`
((short_var_declaration
left: (expression_list
(identifier) @_var)
right: (expression_list
(raw_string_literal) @json))
(#lua-match? @_var ".*[J|j]son.*")
(#offset! @json 0 1 0 -1))
; nvim 0.10
(const_spec
name: ((identifier) @_const(#lua-match? @_const ".*[J|j]son.*"))
value: (expression_list (raw_string_literal) @injection.content
(#set! injection.language "json")))
(short_var_declaration
left: (expression_list (identifier) @_var (#lua-match? @_var ".*[J|j]son.*"))
right: (expression_list (raw_string_literal) @injection.content)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "json"))
(var_spec
name: ((identifier) @_const(#lua-match? @_const ".*[J|j]son.*"))
value: (expression_list (raw_string_literal) @injection.content
(#set! injection.language "json")))