personal laptop changes
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "105b5f7f72c13e682a3aa5d29eac2408ae513b22" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "7c2a432238b9c8e8c526619fa003e658691ea127" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "79644dbedc189d79573b2a60e247989bbd8f16e7" },
|
||||
"asyncrun.vim": { "branch": "master", "commit": "7191d0c30dd105e5d7f897b9a6ee19cabe734466" },
|
||||
"auto-session": { "branch": "main", "commit": "21033c6815f249a7839c3a85fc8a6b44d74925c9" },
|
||||
"calendar-vim": { "branch": "master", "commit": "a7e73e02c92566bf427b2a1d6a61a8f23542cc21" },
|
||||
"catppuccin": { "branch": "main", "commit": "2df7036c5c303c9184869936e40ca18935e4afcb" },
|
||||
"catppuccin": { "branch": "main", "commit": "12894370fa3c9e2200f3724c4184354d6b79733a" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
@ -22,54 +22,54 @@
|
||||
"conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" },
|
||||
"crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "fa4f2729cc2909db599169f22d8e55632d4c8d59" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "5749f093759c29e3694053d048ceb940fe12c3d3" },
|
||||
"fzf": { "branch": "master", "commit": "d0b7780239dd9f9e2bf6c252e03b463990a966bd" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "c85153a188b260b908bc35ffedff64810a930b64" },
|
||||
"fzf": { "branch": "master", "commit": "01302d097c39c3429de65424c6adb75fcac82187" },
|
||||
"fzf.vim": { "branch": "master", "commit": "1dcdb21db618055134cd611f4f5918f6d00a5df0" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "8d962d83cae924a314965f738ed1e05a4000d682" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4455bb5364d29ff86639dfd5533d4fe4b48192d4" },
|
||||
"go.nvim": { "branch": "master", "commit": "a8095eb334495caec3099b717cc7f5b1fbc3e628" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "a36bc3360d584d39b4fb076d855c4180842d4444" },
|
||||
"go.nvim": { "branch": "master", "commit": "97b76f3188c64d4dacfc17c7c1543f775a3fb8e8" },
|
||||
"guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" },
|
||||
"java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" },
|
||||
"kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "678179543e0d27650c328d8659f2c2cab4d854ef" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "f8611632d0f9c6818e8eb54f9bcd1dad122b5a7f" },
|
||||
"libp.nvim": { "branch": "main", "commit": "636b1748e92f66022c1763f32b2ded6b8606eda5" },
|
||||
"lsp-lens.nvim": { "branch": "main", "commit": "450736ecde76e4e127a7724ec8f6e260870863f8" },
|
||||
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
||||
"lsp-zero.nvim": { "branch": "v2.x", "commit": "cf38e6034f2d776ebd16304a334b79543d1ffa60" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "3b57922d2d79762e6baedaf9d66d8ba71f822816" },
|
||||
"lsp-zero.nvim": { "branch": "v2.x", "commit": "52582fc91efb40ee347c20570ff7d32849ef4a89" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "f53af96d4789eef39a082dbcce078d2bfc384ece" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "4f1c72767bec31397d59554f84096909b2887195" },
|
||||
"mason.nvim": { "branch": "main", "commit": "de5959dfc11688be554a53ac95d14bded9eaca4c" },
|
||||
"mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "d883632bf8f92f1d5abea4a9c28fb2f90aa795aa" },
|
||||
"nerdcommenter": { "branch": "master", "commit": "b0b09ea46c9f0509556257bd8b838b40f493d6a0" },
|
||||
"nui.nvim": { "branch": "main", "commit": "f008972ac7d24f7188521a7f8d158aac2fb0b07e" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "f765e75e7d2444629b5ace3cd7609c12251de254" },
|
||||
"nerdcommenter": { "branch": "master", "commit": "ab2ae4d502a26bc591db78a8548823ddd04bbc9c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "608547dcd1381ae791120674e105f5ebae25b37f" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "e8f7dd7a72de3e7b6626c050a802000e69d53ff0" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "2743dd989e9b932e1b4813a4927d7b84272a14e2" },
|
||||
"nvim-lightbulb": { "branch": "master", "commit": "ca5b44a8efffb5fec1963ccd21f25ec04cc778b7" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "08f1f347c718e945c3b1712ebb68c6834182cf3a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0011c435282f043a018e23393cae06ed926c3f4a" },
|
||||
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
|
||||
"nvim-osc52": { "branch": "main", "commit": "3e96035d62290183fe7a11418db2b254fcfcaee3" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9c9e12f0333a1686171a1315b237e9f6c49ff41d" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "36aaceb6e93addd20b1b18f94d86aecc552f30c4" },
|
||||
"refactoring.nvim": { "branch": "master", "commit": "08bcc40638cd4debd5184f934971858e1c5acff4" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "c42a8f96d37be82cf32934c4351150d7736f93f5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "102c02903c74b93c705406bf362049383abc87c8" },
|
||||
"refactoring.nvim": { "branch": "master", "commit": "859289acc0fda13bf42834dbeef10b8c1148d444" },
|
||||
"registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" },
|
||||
"telekasten.nvim": { "branch": "main", "commit": "36dad2692974a5cc69813441442ccce8c53fbfd4" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "87dfaa9a9c251388cf4f01b9d4078c29d1fc8803" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" },
|
||||
"telekasten.nvim": { "branch": "main", "commit": "eb1d228e8d97437fa763ab1c6fcc1ab572d7ce7a" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "e03ff55962417b69c85ef41424079bb0580546ba" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "0e0600908d1ad5ac4992fa0ab578e23e9d9d6f37" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "d99e2abd10808ef91738ce98a5c767e6a51df449" },
|
||||
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
|
||||
"vcscommand.vim": { "branch": "master", "commit": "2fb32681361f37533455d20aaa7fc6eb11b0fa4b" },
|
||||
"vim-better-whitespace": { "branch": "master", "commit": "1b22dc57a2751c7afbc6025a7da39b7c22db635d" },
|
||||
"vim-dirdiff": { "branch": "master", "commit": "84bc8999fde4b3c2d8b228b560278ab30c7ea4c9" },
|
||||
"vim-indent-guides": { "branch": "master", "commit": "a1e1390c0136e63e813d051de2003bf0ee18ae30" },
|
||||
"vim-matchup": { "branch": "master", "commit": "3625e099b09bff2db5f04082cb09ba679525980c" },
|
||||
"vim-matchup": { "branch": "master", "commit": "61cef7921ecbb412f341a6d1a7f9ad1ca55243de" },
|
||||
"vim-ripgrep": { "branch": "master", "commit": "2bb2425387b449a0cd65a54ceb85e123d7a320b8" },
|
||||
"vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" },
|
||||
"vim-signify": { "branch": "master", "commit": "7d538b77a5a8806e344b057f8846f6d0c035efa9" },
|
||||
@ -81,5 +81,5 @@
|
||||
"vim-tmux-yank": { "branch": "master", "commit": "8432fd440f61ddead070093be06b3dd6b0b5790e" },
|
||||
"vim-windowswap": { "branch": "master", "commit": "15db3f697aa1fa696d99fcdc920c90cd2cec855e" },
|
||||
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "d871f2b664afd5aed3dc1d1573bef2fb24ce0484" }
|
||||
}
|
@ -201,9 +201,11 @@ return {
|
||||
capabilities = require("cmp_nvim_ciderlsp").update_capabilities(capabilities)
|
||||
capabilities.workspace.codeLens = { refreshSupport = true }
|
||||
capabilities.workspace.diagnostics = { refreshSupport = true }
|
||||
|
||||
lspconfig.analysislsp.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = cider_on_attach,
|
||||
|
@ -1,10 +1,41 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
config = function()
|
||||
local TableConcat = require("utils").TableConcat
|
||||
local use_google = require("utils").use_google
|
||||
|
||||
local lsps = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
}
|
||||
|
||||
if not use_google then
|
||||
TableConcat(lsps, {
|
||||
"gopls",
|
||||
"graphql",
|
||||
})
|
||||
end
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "rust_analyzer" },
|
||||
ensure_installed = lsps,
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup({})
|
||||
end,
|
||||
-- Next, you can provide a dedicated handler for specific servers.
|
||||
-- For example, a handler override for the `rust_analyzer`:
|
||||
["rust_analyzer"] = function()
|
||||
require("rust-tools").setup({})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ return {
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local use_google = require("utils").use_google
|
||||
local TableConcat = require("utils").TableConcat
|
||||
|
||||
local sources = {
|
||||
-- Catch insensitive, inconsiderate writing.
|
||||
@ -12,7 +14,7 @@ return {
|
||||
null_ls.builtins.diagnostics.buildifier,
|
||||
|
||||
-- Codespell finds common misspellings in text files.
|
||||
-- null_ls.builtins.diagnostics.codespell,
|
||||
null_ls.builtins.diagnostics.codespell,
|
||||
-- null_ls.builtins.diagnostics.cspell, null_ls.builtins.code_actions.cspell,
|
||||
|
||||
-- An English prose linter. Can fix some issues via code actions.
|
||||
@ -22,6 +24,22 @@ return {
|
||||
null_ls.builtins.formatting.google_java_format,
|
||||
}
|
||||
|
||||
if not use_google then
|
||||
TableConcat(sources, {
|
||||
-- Bazel
|
||||
null_ls.builtins.diagnostics.buildifier,
|
||||
null_ls.builtins.formatting.buildifier,
|
||||
-- Golang
|
||||
null_ls.builtins.diagnostics.golangci_lint,
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.goimports_reviser,
|
||||
-- Misc
|
||||
null_ls.builtins.formatting.htmlbeautifier,
|
||||
null_ls.builtins.formatting.jq,
|
||||
null_ls.builtins.formatting.mdformat,
|
||||
})
|
||||
end
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
})
|
||||
|
@ -1,11 +1,31 @@
|
||||
local use_google = require("utils").use_google
|
||||
local TableConcat = require("utils").TableConcat
|
||||
local keys = {
|
||||
{ "<leader>fb", ":Telescope file_browser path=%:p:h select_buffer=true<CR>", desc = "[F]ile [B]rowser" },
|
||||
{ "<leader>tb", ":Telescope file_buffers<CR>", desc = "[T]elescope [B]uffers" },
|
||||
{ "<leader>th", [[:lua require('telescope.builtin').help_tags<cr>]], desc = "[T]elescope [H]elp" },
|
||||
{ "<leader>t*", [[:lua require('telescope.builtin').grep_string<cr>]], desc = "[T]elescope current [W]ord" },
|
||||
{ "<leader>tg", [[:lua require('telescope.builtin').live_grep<cr>]], desc = "[T]elescope by [G]rep" },
|
||||
}
|
||||
|
||||
if use_google() then
|
||||
TableConcat(keys, {
|
||||
{ "<C-P>", [[:lua require('telescope').extensions.codesearch.find_files{}<CR>]], "n" },
|
||||
{ "<C-Space>", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
|
||||
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
|
||||
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode = "v" },
|
||||
{
|
||||
"<leader>CS",
|
||||
[[:lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
}, {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
@ -52,51 +72,5 @@ return {
|
||||
})
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>fb",
|
||||
":Telescope file_browser path=%:p:h select_buffer=true<CR>",
|
||||
{ noremap = true },
|
||||
desc = "[F]ile [B]rowser",
|
||||
},
|
||||
{
|
||||
"<leader>tf",
|
||||
":Telescope file_browser",
|
||||
{ noremap = true },
|
||||
desc = "[T]elescope [F]ilebrowser",
|
||||
},
|
||||
{ "<leader>tb", ":Telescope file_buffers", desc = "[T]elescope [B]uffers" },
|
||||
{ "<leader>th", [[:lua require('telescope.builtin').help_tags<cr>]], desc = "[T]elescope [H]elp" },
|
||||
{ "<leader>tw", [[:lua require('telescope.builtin').grep_string<cr>]], desc = "[T]elescope current [W]ord" },
|
||||
{ "<leader>tg", [[:lua require('telescope.builtin').live_grep<cr>]], desc = "[T]elescope by [G]rep" },
|
||||
|
||||
-- Google mappings
|
||||
{
|
||||
"<C-P>",
|
||||
[[:lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
"n",
|
||||
{ noremap = true, silent = true },
|
||||
},
|
||||
{
|
||||
"<C-Space>",
|
||||
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent = true },
|
||||
},
|
||||
{
|
||||
"<leader>cs",
|
||||
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent = true },
|
||||
},
|
||||
{
|
||||
"<leader>cs",
|
||||
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
mode = "v",
|
||||
{ noremap = true, silent = true },
|
||||
},
|
||||
{
|
||||
"<leader>CS",
|
||||
[[:lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
|
||||
{ noremap = true, silent = true },
|
||||
},
|
||||
},
|
||||
keys = keys,
|
||||
}
|
||||
|
@ -1,67 +1,83 @@
|
||||
local M = {}
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function M.use_google()
|
||||
return M.file_exists(os.getenv("HOME").."/use_google")
|
||||
return M.file_exists(os.getenv("HOME") .. "/use_google")
|
||||
end
|
||||
|
||||
function M.file_exists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function M.dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. M.dump(v) .. ','
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
if type(o) == "table" then
|
||||
local s = "{ "
|
||||
for k, v in pairs(o) do
|
||||
if type(k) ~= "number" then
|
||||
k = '"' .. k .. '"'
|
||||
end
|
||||
s = s .. "[" .. k .. "] = " .. M.dump(v) .. ","
|
||||
end
|
||||
return s .. "} "
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
function M.tprint (tbl, indent)
|
||||
if not indent then indent = 0 end
|
||||
local toprint = string.rep(" ", indent) .. "{\r\n"
|
||||
indent = indent + 2
|
||||
for k, v in pairs(tbl) do
|
||||
toprint = toprint .. string.rep(" ", indent)
|
||||
if (type(k) == "number") then
|
||||
toprint = toprint .. "[" .. k .. "] = "
|
||||
elseif (type(k) == "string") then
|
||||
toprint = toprint .. k .. "= "
|
||||
end
|
||||
if (type(v) == "number") then
|
||||
toprint = toprint .. v .. ",\r\n"
|
||||
elseif (type(v) == "string") then
|
||||
toprint = toprint .. "\"" .. v .. "\",\r\n"
|
||||
elseif (type(v) == "table") then
|
||||
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
|
||||
else
|
||||
toprint = toprint .. "\"" .. tostring(v) .. "\",\r\n"
|
||||
end
|
||||
end
|
||||
toprint = toprint .. string.rep(" ", indent-2) .. "}"
|
||||
return toprint
|
||||
function M.tprint(tbl, indent)
|
||||
if not indent then
|
||||
indent = 0
|
||||
end
|
||||
local toprint = string.rep(" ", indent) .. "{\r\n"
|
||||
indent = indent + 2
|
||||
for k, v in pairs(tbl) do
|
||||
toprint = toprint .. string.rep(" ", indent)
|
||||
if type(k) == "number" then
|
||||
toprint = toprint .. "[" .. k .. "] = "
|
||||
elseif type(k) == "string" then
|
||||
toprint = toprint .. k .. "= "
|
||||
end
|
||||
if type(v) == "number" then
|
||||
toprint = toprint .. v .. ",\r\n"
|
||||
elseif type(v) == "string" then
|
||||
toprint = toprint .. '"' .. v .. '",\r\n'
|
||||
elseif type(v) == "table" then
|
||||
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
|
||||
else
|
||||
toprint = toprint .. '"' .. tostring(v) .. '",\r\n'
|
||||
end
|
||||
end
|
||||
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
|
||||
return toprint
|
||||
end
|
||||
|
||||
function M.log(message)
|
||||
local log_file_path = vim.fn.expand('$HOME/nvim.log')
|
||||
local log_file = io.open(log_file_path, "a")
|
||||
io.output(log_file)
|
||||
io.write(message.."\n")
|
||||
io.close(log_file)
|
||||
local log_file_path = vim.fn.expand("$HOME/nvim.log")
|
||||
local log_file = io.open(log_file_path, "a")
|
||||
io.output(log_file)
|
||||
io.write(message .. "\n")
|
||||
io.close(log_file)
|
||||
end
|
||||
|
||||
function M.TableConcat(t1, t2)
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user