tangled
alpha
login
or
join now
seth.computer
/
dotfiles
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
wip: line wrap on new buffers
seth.computer
2 years ago
82d0a64b
fd4a6b59
verified
This commit was signed with the committer's
known signature
.
seth.computer
SSH Key Fingerprint:
SHA256:l+TmfElcKWTGSvrmVQkRAqucAII4w28uPbCCkXB+x7o=
+42
-8
1 changed file
expand all
collapse all
unified
split
vim
lvim
config.lua
+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
37
-
lvim.builtin.which_key.mappings["w?"] = { ":sp<cr>", "Split horizontal" }
38
38
-
lvim.builtin.which_key.mappings["w/"] = { ":vsp<cr>", "Split vertical" }
37
37
+
lvim.builtin.which_key.mappings["w?"] = { ":sp<cr>", "Split horizontal", mode = { "n" } }
38
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
58
+
-- DEBUG
59
59
+
function DumpTable(table, depth)
60
60
+
if (depth > 200) then
61
61
+
print("Error: Depth > 200 in dumpTable()")
62
62
+
return
63
63
+
end
64
64
+
for k, v in pairs(table) do
65
65
+
if (type(v) == "table") then
66
66
+
print(string.rep(" ", depth) .. k .. ":")
67
67
+
DumpTable(v, depth + 1)
68
68
+
else
69
69
+
print(string.rep(" ", depth) .. k .. ": ", v)
70
70
+
end
71
71
+
end
72
72
+
end
58
73
59
59
-
-- Lang specific config
74
74
+
-- Filetype based settings
75
75
+
function SetLineWrapForTextFiles(opts)
76
76
+
local ft = vim.bo[opts.buf].filetype
77
77
+
-- print(DumpTable(opts, 10))
78
78
+
-- print(opts.buf, ft)
79
79
+
if ft == "" or ft == "markdown" or ft == "text" then
80
80
+
-- print("SETTING THE WRAP!")
81
81
+
vim.bo[opts.buf].wrap = true
82
82
+
vim.bo[opts.buf].linebreak = true
83
83
+
vim.bo[opts.buf].list = false
84
84
+
end
85
85
+
end
86
86
+
87
87
+
local myAuGroup = vim.api.nvim_create_augroup("MyGroup", { clear = true })
88
88
+
lvim.autocommands = {
89
89
+
{ "FileType", { pattern = { "*" }, group = myAuGroup, callback = SetLineWrapForTextFiles } },
90
90
+
{ "BufAdd", { pattern = { "*" }, group = myAuGroup, callback = SetLineWrapForTextFiles } },
91
91
+
}
92
92
+
93
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
77
-
function Git_url(line1, line2)
111
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
93
-
function Git_open(line1, line2)
94
94
-
local git_open_cmd = Git_url(line1, line2)
127
127
+
function GitOpen(line1, line2)
128
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
98
-
function Git_copy(line1, line2)
99
99
-
local git_open_cmd = Git_url(line1, line2)
132
132
+
function GitCopy(line1, line2)
133
133
+
local git_open_cmd = GitUrl(line1, line2)
100
134
vim.cmd(string.format("!%s | pbcopy", git_open_cmd))
101
135
end
102
136