-
Notifications
You must be signed in to change notification settings - Fork 0
/
lvim.lua
199 lines (181 loc) · 6.16 KB
/
lvim.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
vim.opt.relativenumber = true
lvim.log.level = "warn"
lvim.format_on_save.enabled = false
lvim.colorscheme = "lunar"
lvim.leader = "space"
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
lvim.builtin.treesitter.ensure_installed = {
"bash",
"javascript",
"json",
"lua",
"python",
"typescript",
"tsx",
"css",
"yaml",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enable = true
-- https://www.lunarvim.org/docs/configuration/language-features/language-servers#by-overriding-the-setup
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
require("lvim.lsp.manager").setup("pyright", {
settings = {
python = { analysis = { typeCheckingMode = "off" } },
},
})
-- Additional Plugins
lvim.plugins = {
{
"ggandor/leap.nvim",
config = function()
require("leap").create_default_mappings()
end,
},
{
"iamcco/markdown-preview.nvim",
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
},
{
"nvim-neotest/neotest",
config = function()
require("neotest").setup({
adapters = {
require("neotest-python")({
dap = { justMyCode = false },
args = { "-vv" },
}),
},
})
end,
dependencies = {
"nvim-neotest/neotest-python",
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
},
},
{
"kevinhwang91/nvim-bqf",
event = { "BufRead", "BufNew" },
config = function()
require("bqf").setup({
auto_enable = true,
preview = {
win_height = 12,
win_vheight = 12,
delay_syntax = 80,
border_chars = { "┃", "┃", "━", "━", "┏", "┓", "┗", "┛", "█" },
},
func_map = {
vsplit = "",
ptogglemode = "z,",
stoggleup = "",
},
filter = {
fzf = {
action_for = { ["ctrl-s"] = "split" },
extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " },
},
},
})
end,
},
{
"mfussenegger/nvim-dap-python",
config = function()
dap_python = require("dap-python")
dap_python.setup("~/.pyenv/versions/debugpy/bin/python")
dap_python.test_runner = "pytest"
end,
},
{
"romgrk/nvim-treesitter-context",
config = function()
require("treesitter-context").setup({
enable = true,
throttle = true,
max_lines = 1,
patterns = {
default = {
"class",
"function",
"method",
},
},
})
end,
},
{
"tiagovla/scope.nvim",
config = function()
require("scope").setup()
end,
},
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({
keymaps = {
accept_suggestion = "<M-l>",
accept_word = "<M-a>",
},
})
end,
},
}
lvim.keys.normal_mode["<leader>g"] = ":Telescope live_grep<cr>"
lvim.builtin.which_key.mappings["dm"] = { ":lua require('neotest').run.run({strategy = 'dap'})<CR>", "Neotest Closest" }
lvim.builtin.which_key.mappings["df"] =
{ ":lua require('neotest').run.run({vim.fn.expand('%'), strategy = 'dap'})<CR>", "Neotest File" }
lvim.builtin.which_key.mappings["t"] = "+Test"
lvim.builtin.which_key.mappings["ta"] = { ":lua require('neotest').run.run(vim.fn.getcwd())<CR>", "Run All" }
lvim.builtin.which_key.mappings["tf"] = { ":lua require('neotest').run.run(vim.fn.expand('%'))<CR>", "Run File" }
lvim.builtin.which_key.mappings["tm"] = { ":lua require('neotest').run.run()<CR>", "Run Closest" }
lvim.builtin.which_key.mappings["to"] = { ":Neotest output<CR>", "Output" }
lvim.builtin.which_key.mappings["ts"] = { ":lua require('neotest').summary.toggle()<cr>", "Summary" }
lvim.keys.normal_mode["<C-t>"] = ":tabnew<CR>"
lvim.keys.normal_mode["gt"] = ":tabnext<CR>"
lvim.keys.normal_mode["gT"] = ":tabprev<CR>"
lvim.keys.normal_mode["gW"] = ":tabclose<CR>"
lvim.keys.normal_mode["<S-TAB>"] = ":bnext<CR>"
require("bufferline").setup({
options = {
always_show_bufferline = true,
},
})
function _G.break_line_at_80()
local bufnr = vim.api.nvim_get_current_buf()
local cursor_pos = vim.api.nvim_win_get_cursor(0)
local line_num = cursor_pos[1]
local cur_line = vim.api.nvim_buf_get_lines(bufnr, line_num - 1, line_num, false)[1]
local break_pos = 80
-- If the line is shorter than the break position, do nothing
if #cur_line <= break_pos then
return
end
-- Find the position of the last whitespace before the break position
local break_at = cur_line:sub(1, break_pos):reverse():find("%s")
if break_at then
break_at = break_pos - break_at + 1
else
break_at = break_pos
end
-- Split the line
local new_cur_line = cur_line:sub(1, break_at):gsub("%s+$", "")
local new_next_line = " " .. cur_line:sub(break_at + 1):gsub("^%s+", "")
-- Update the buffer
vim.api.nvim_buf_set_lines(bufnr, line_num - 1, line_num, false, { new_cur_line, new_next_line })
vim.api.nvim_win_set_cursor(0, { line_num + 1, 0 })
end
lvim.keys.normal_mode["<leader>b"] = ":lua break_line_at_80()<CR>"