Last active
May 21, 2025 07:39
-
-
Save kuator/10f7898c6e15c1c5edf54aba6eb9bd44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local root = vim.fn.fnamemodify("./.repro", ":p") | |
-- set stdpaths to use .repro | |
for _, name in ipairs({ "config", "data", "state", "cache" }) do | |
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name | |
end | |
-- bootstrap lazy | |
local lazypath = root .. "/plugins/lazy.nvim" | |
if not vim.loop.fs_stat(lazypath) then | |
vim.fn.system({ | |
"git", | |
"clone", | |
"--filter=blob:none", | |
"--single-branch", | |
"https://github.com/folke/lazy.nvim.git", | |
lazypath, | |
}) | |
end | |
vim.opt.runtimepath:prepend(lazypath) | |
-- install plugins | |
local plugins = { | |
-- do not remove the colorscheme! | |
"folke/tokyonight.nvim", | |
-- { | |
-- config = function () | |
-- require("nvim-treesitter-textobjects").setup { | |
-- select = { | |
-- -- Automatically jump forward to textobj, similar to targets.vim | |
-- lookahead = true, | |
-- -- You can choose the select mode (default is charwise 'v') | |
-- -- | |
-- -- Can also be a function which gets passed a table with the keys | |
-- -- * query_string: eg '@function.inner' | |
-- -- * method: eg 'v' or 'o' | |
-- -- and should return the mode ('v', 'V', or '<c-v>') or a table | |
-- -- mapping query_strings to modes. | |
-- selection_modes = { | |
-- ['@parameter.outer'] = 'v', -- charwise | |
-- ['@function.outer'] = 'V', -- linewise | |
-- ['@class.outer'] = '<c-v>', -- blockwise | |
-- }, | |
-- -- If you set this to `true` (default is `false`) then any textobject is | |
-- -- extended to include preceding or succeeding whitespace. Succeeding | |
-- -- whitespace has priority in order to act similarly to eg the built-in | |
-- -- `ap`. | |
-- -- | |
-- -- Can also be a function which gets passed a table with the keys | |
-- -- * query_string: eg '@function.inner' | |
-- -- * selection_mode: eg 'v' | |
-- -- and should return true of false | |
-- include_surrounding_whitespace = false, | |
-- }, | |
-- } | |
-- vim.keymap.set("n", "<a-l>", function() | |
-- require("nvim-treesitter-textobjects.swap").swap_next {"@parameter.inner", "@function.outer"} | |
-- end) | |
-- vim.keymap.set("n", "<a-h>", function() | |
-- require("nvim-treesitter-textobjects.swap").swap_previous {"@parameter.inner", "@function.outer"} | |
-- end) | |
-- end, | |
-- "nvim-treesitter/nvim-treesitter-textobjects", | |
-- branch = 'main', | |
-- dependencies = {"nvim-treesitter/nvim-treesitter", branch='main'}, | |
-- } | |
{ | |
config = function () | |
require'nvim-treesitter.configs'.setup { | |
textobjects = { | |
swap = { | |
enable = true, | |
swap_next = { | |
["<a-l>"] = { query = { "@parameter.inner", "@statement.outer", "@function.outer" } }, | |
}, | |
swap_previous = { | |
["<a-h>"] = { query = { "@parameter.inner", "@statement.outer", "@function.outer" } }, | |
}, | |
}, | |
}, | |
} | |
end, | |
"nvim-treesitter/nvim-treesitter-textobjects", | |
dependencies = "nvim-treesitter/nvim-treesitter", | |
} | |
-- add any other pugins here | |
} | |
require("lazy").setup(plugins, { | |
root = root .. "/plugins", | |
}) | |
-- add anything else here | |
vim.opt.termguicolors = true | |
-- do not remove the colorscheme! | |
vim.cmd([[colorscheme tokyonight]]) | |
vim.cmd[[set clipboard=unnamedplus]] | |
vim.cmd[[inoremap kj <esc>]] | |
vim.cmd[[set number]] | |
local function another(third, second, first) | |
end | |
local function some(third, second, first) | |
end | |
local test_code = { | |
'aaronik/treewalker.nvim', | |
-- The following options are the defaults. | |
-- Treewalker aims for sane defaults, so these are each individually optional, | |
-- and setup() does not need to be called, so the whole opts block is optional as well. | |
opts = { | |
-- Whether to briefly highlight the node after jumping to it | |
highlight = true, | |
-- How long should above highlight last (in ms) | |
highlight_duration = 250, | |
-- The color of the above highlight. Must be a valid vim highlight group. | |
-- (see :h highlight-group for options) | |
highlight_group = 'CursorLine', | |
-- Whether the plugin adds movements to the jumplist -- true | false | 'left' | |
-- true: All movements more than 1 line are added to the jumplist. This is the default, | |
-- and is meant to cover most use cases. It's modeled on how { and } natively add | |
-- to the jumplist. | |
-- false: Treewalker does not add to the jumplist at all | |
-- "left": Treewalker only adds :Treewalker Left to the jumplist. This is usually the most | |
-- likely one to be confusing, so it has its own mode. | |
jumplist = true, | |
}, | |
config = function () | |
-- :Treewalker Up - Moves up to the previous neighbor node | |
-- :Treewalker Down - Moves down to the next neighbor node | |
-- :Treewalker Left - Moves to the first ancestor node that's on a different line from the current node | |
-- :Treewalker Right - Moves to the next node down that's indented further than the current node | |
-- vim.keymap.set({ 'n', 'v' }, '<C-p>', '<cmd>Treewalker Up<cr>', { silent = true }) | |
-- vim.keymap.set({ 'n', 'v' }, '<C-n>', '<cmd>Treewalker Down<cr>', { silent = true }) | |
-- vim.keymap.set({ 'n', 'v' }, '<a-n>', '<cmd>Treewalker Left<cr>', { silent = true }) | |
-- vim.keymap.set({ 'n', 'v' }, '<a-p>', '<cmd>Treewalker Right<cr>', { silent = true }) | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment