-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
executable file
·302 lines (265 loc) · 9.65 KB
/
config.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
require("plugins")
-- vim.lsp.set_log_level("debug")
vim.g.skip_ts_context_commentstring_module = true
require("bufferline").setup {
options = {
-- enable = false,
buffer_close_icon = 'x',
close_icon = '',
}
}
vim.cmd("set number relativenumber")
vim.cmd("set timeoutlen=150")
vim.cmd("set viminfo='100,<50,s10,h,%")
vim.opt.scrolloff = 16
-- vim.cmd([[command! -nargs=0 Session :lua MiniSessions.read()]])
vim.cmd([[command! -nargs=0 GoToFile :Telescope find_files]])
vim.cmd([[command! -nargs=0 GoToCommand :Telescope commands]])
vim.cmd([[command! -nargs=0 FindFile :Telescope live_grep]])
vim.cmd('highlight clear CursorLine')
vim.cmd('highlight clear CursorLineNR')
lvim.format_on_save = false
lvim.leader = "space"
lvim.colorscheme = 'catppuccin'
-- require("mason-lspconfig").setup {
-- ensure_installed = {},
-- }
require("cmpMappings")
require("linters")
require("which")
require("catppuccin").setup({
flavour = "mocha", -- latte, frappe, macchiato, mocha
background = {
light = "latte",
dark = "latte",
},
transparent_background = true, -- disables setting the background color.
})
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.width = 46
lvim.builtin.nvimtree.setup.view.float.enable = false
lvim.builtin.nvimtree.setup.view.float.open_win_config = {
relative = "win",
border = "rounded",
width = 54,
height = 32,
-- bufpos={50,10}
row = 3,
col = 3,
}
-- lvim.builtin.nvimtree.setup.view.float.open_win_config.width = 110
-- lvim.builtin.nvimtree.setup.view.float.open_win_config.height = 40
-- lvim.builtin.nvimtree.setup.view.float.open_win_config.col = 20
-- lvim.builtin.nvimtree.setup.view.float.open_win_config.row = 3
lvim.builtin.nvimtree.setup.reload_on_bufenter = true
lvim.builtin.nvimtree.setup.auto_reload_on_write = true
require("telescope").load_extension("package_info")
lvim.builtin.alpha.dashboard.section.buttons.entries = {
{ "s", lvim.icons.ui.Code .. " Sessions", "<CMD>SessionManager<CR>" },
{ "f", lvim.icons.ui.FindFile .. " Find File", "<CMD>Telescope find_files<CR>" },
{ "g", lvim.icons.ui.FindText .. " Grep By", "<CMD>Telescope live_grep<CR>" },
{ "n", lvim.icons.ui.NewFile .. " New File", "<CMD>ene!<CR>" },
{ "p", lvim.icons.ui.Project .. " Projects ", "<CMD>Telescope projects<CR>" },
{ "r", lvim.icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>" },
}
local config = require('session_manager.config')
require('session_manager').setup({
autoload_mode = { config.AutoloadMode.GitSession, config.AutoloadMode.CurrentDir }, -- Define what to do when Neovim is started without arguments. See "Autoload mode" section below.
autosave_last_session = true, -- Automatically save last session on exit and on session switch.
autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
-- autosave_ignore_dirs = {}, -- A list of directories where the session will not be autosaved.
-- autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved.
-- 'gitcommit',
-- 'gitrebase',
-- },
-- autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved.
-- autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active.
-- max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all.
})
local actions = require("lvim.utils.modules").require_on_exported_call "telescope.actions"
local fb_actions = require "telescope".extensions.file_browser.actions
lvim.builtin.telescope = {
active = true,
defaults = {
path_display = { "truncate" },
-- layout_strategy = "vertical",
-- layout_strategy = "horizontal",
layout_strategy = "flex",
layout_config = {
flip_columns = 130,
width = 0.85,
height = 0.88,
preview_cutoff = 20,
horizontal = {
preview_width = 0.5,
},
prompt_position = "bottom",
},
mappings = {
n = {
["q"] = actions.close,
["h"] = fb_actions.goto_parent_dir,
["l"] = actions.select_default,
["u"] = fb_actions.toggle_respect_gitignore,
["U"] = fb_actions.toggle_hidden,
["F"] = fb_actions.toggle_browser,
["f"] = function()
require('telescope.builtin').git_files()
end
},
},
},
pickers = {
git_files = {
hidden = true,
},
live_grep = {
hidden = true,
},
},
}
lvim.builtin.telescope.defaults.prompt_prefix = " "
lvim.builtin.telescope.defaults.selection_caret = "> "
-- lvim.builtin.telescope.defaults.file_ignore_patterns = { "NvimTree", ".yarn" }
--
require 'nvim-treesitter.configs'.setup {
autotag = {
enable = true,
},
rainbow = {
enable = true,
-- list of languages you want to disable the plugin for
-- disable = { 'jsx', 'cpp' },
-- Which query to use for finding delimiters
-- query = 'rainbow-parens',
-- Highlight the entire buffer all at once
-- strategy = require('ts-rainbow').strategy.global,
},
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
ensure_installed = { "lua", "vim", "vimdoc", "javascript", "typescript", "json", "dockerfile", "tsx", "vue" },
}
lvim.lsp.installer.setup.automatic_installation.exclude = { 'tsserver' }
-- section_separators = { left = '', right = '' },
vim.cmd("set cmdheight=0")
local function searchCount()
local search = vim.fn.searchcount({ maxcount = 0 }) -- maxcount = 0 makes the number not be capped at 99
local searchCurrent = search.current
local searchTotal = search.total
if searchCurrent > 0 then
return "/" .. vim.fn.getreg("/") .. " [" .. searchCurrent .. "/" .. searchTotal .. "]"
else
return ""
end
end
local package_info = require("package-info")
local function getPackageInfoStatus()
return package_info.get_status()
end
-- local components = require("lvim.core.lualine.components")
-- lvim.builtin.lualine.winbar = {
-- lualine_a = { {
-- 'buffers',
-- section_separators = { left = '', right = '' },
-- },
-- },
-- }
lvim.builtin.lualine.sections.lualine_b = { 'branch', 'diff' }
lvim.builtin.lualine.options.section_separators = { left = '', right = '' }
lvim.builtin.lualine.sections.lualine_c = {
{ "filename", file_status = true, newfile_status = false, path = 3, shorting_target = 30 },
}
lvim.builtin.lualine.sections.lualine_x = { 'diagnostics', { searchCount } }
lvim.builtin.lualine.sections.lualine_y = {
'location',
{ getPackageInfoStatus }
}
local fineline = require('fine-cmdline')
fineline.setup({
cmdline = {
enable_keymaps = true,
smart_history = true,
prompt = ' '
},
popup = {
position = {
row = '24%',
col = '50%',
},
size = {
width = '50%',
},
border = {
style = 'rounded',
},
win_options = {
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder',
},
},
})
-- automatically close the tab/vim when nvim-tree is the last window in the tab
vim.api.nvim_create_autocmd("BufEnter", {
nested = true,
callback = function()
if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
vim.cmd("quit")
end
end,
})
require("indent_blankline").setup({
filetype = { "yaml", "yml" },
show_current_context = false,
show_trailing_blankline_indent = false,
})
require('package-info').setup(
{
colors = {
up_to_date = "#3C4048", -- Text color for up to date dependency virtual text
outdated = "#d19a66", -- Text color for outdated dependency virtual text
},
icons = {
enable = true, -- Whether to display icons
style = {
up_to_date = "| ", -- Icon for up to date dependencies
outdated = "| ", -- Icon for outdated dependencies
},
},
autostart = true, -- Whether to autostart when `package.json` is opened
hide_up_to_date = true, -- It hides up to date versions when displaying virtual text
hide_unstable_versions = false, -- It hides unstable versions from version list e.g next-11.1.3-canary3
-- Can be `npm`, `yarn`, or `pnpm`. Used for `delete`, `install` etc...
-- The plugin will try to auto-detect the package manager based on
-- `yarn.lock` or `package-lock.json`. If none are found it will use the
-- provided one, if nothing is provided it will use `yarn`
package_manager = "npm"
}
)
require("lint-node").setup({
command = "npm run lint:cmd", -- or any other command
key = "t",
debug = true
})
-- Call the setup function
require("pair-ls").setup({
-- The pair-ls command to run
cmd = { "pair-ls", "lsp", "-port", "8080" },
-- The function configures the root directory for the server
root_dir = function(fname, util)
return util.root_pattern(".git", ".hg")(fname) or vim.loop.cwd()
end,
-- Pass a function here to run custom logic on attach
on_attach = function(client, bufnr) end,
-- See :help vim.lsp.start_client
flags = {
allow_incremental_sync = true,
debounce_text_changes = nil,
},
})
-- load snippets
-- require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./snippets/" } })