this repo has no description

wip: line wrap on new buffers

seth.computer 82d0a64b fd4a6b59

verified
+42 -8
+42 -8
vim/lvim/config.lua
··· 34 34 lvim.keys.normal_mode["<S-h>"] = ":bprev<cr>" 35 35 lvim.keys.normal_mode["<S-l>"] = ":bnext<cr>" 36 36 37 - lvim.builtin.which_key.mappings["w?"] = { ":sp<cr>", "Split horizontal" } 38 - lvim.builtin.which_key.mappings["w/"] = { ":vsp<cr>", "Split vertical" } 37 + lvim.builtin.which_key.mappings["w?"] = { ":sp<cr>", "Split horizontal", mode = { "n" } } 38 + lvim.builtin.which_key.mappings["w/"] = { ":vsp<cr>", "Split vertical", mode = { "n" } } 39 39 40 40 lvim.builtin.which_key.mappings["gO"] = { ":GitOpen<cr>", "Open file in github/gitlab", mode = { "n", "v" } } 41 41 lvim.builtin.which_key.mappings["gL"] = { ":GitCopy<cr>", "Open file in github/gitlab", mode = { "n", "v" } } ··· 55 55 rd = { "<cmd>lua require('gitlab').delete_reviewer()<cr>", "Remove reviewer" }, 56 56 p = { "<cmd>lua require('gitlab').pipeline()<cr>", "View MR pipeline" }, 57 57 } 58 + -- DEBUG 59 + function DumpTable(table, depth) 60 + if (depth > 200) then 61 + print("Error: Depth > 200 in dumpTable()") 62 + return 63 + end 64 + for k, v in pairs(table) do 65 + if (type(v) == "table") then 66 + print(string.rep(" ", depth) .. k .. ":") 67 + DumpTable(v, depth + 1) 68 + else 69 + print(string.rep(" ", depth) .. k .. ": ", v) 70 + end 71 + end 72 + end 58 73 59 - -- Lang specific config 74 + -- Filetype based settings 75 + function SetLineWrapForTextFiles(opts) 76 + local ft = vim.bo[opts.buf].filetype 77 + -- print(DumpTable(opts, 10)) 78 + -- print(opts.buf, ft) 79 + if ft == "" or ft == "markdown" or ft == "text" then 80 + -- print("SETTING THE WRAP!") 81 + vim.bo[opts.buf].wrap = true 82 + vim.bo[opts.buf].linebreak = true 83 + vim.bo[opts.buf].list = false 84 + end 85 + end 86 + 87 + local myAuGroup = vim.api.nvim_create_augroup("MyGroup", { clear = true }) 88 + lvim.autocommands = { 89 + { "FileType", { pattern = { "*" }, group = myAuGroup, callback = SetLineWrapForTextFiles } }, 90 + { "BufAdd", { pattern = { "*" }, group = myAuGroup, callback = SetLineWrapForTextFiles } }, 91 + } 92 + 93 + -- Formatters 60 94 local formatters = require "lvim.lsp.null-ls.formatters" 61 95 formatters.setup { 62 96 { ··· 74 108 75 109 -- Calls the git-open command to get the URL for a specific file/line 76 110 -- in the github or gitlab remote repo. 77 - function Git_url(line1, line2) 111 + function GitUrl(line1, line2) 78 112 local lines = "" 79 113 80 114 -- Check if multiple lines are selected ··· 90 124 return string.format("git-open %s %s", filename, lines) 91 125 end 92 126 93 - function Git_open(line1, line2) 94 - local git_open_cmd = Git_url(line1, line2) 127 + function GitOpen(line1, line2) 128 + local git_open_cmd = GitUrl(line1, line2) 95 129 vim.cmd(string.format("!%s | xargs open", git_open_cmd)) 96 130 end 97 131 98 - function Git_copy(line1, line2) 99 - local git_open_cmd = Git_url(line1, line2) 132 + function GitCopy(line1, line2) 133 + local git_open_cmd = GitUrl(line1, line2) 100 134 vim.cmd(string.format("!%s | pbcopy", git_open_cmd)) 101 135 end 102 136