-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.lua
123 lines (99 loc) · 3.37 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
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
--
--
lvim.colorscheme = "lunar"
lvim.format_on_save.enabled = false
local formatters = require("lvim.lsp.null-ls.formatters")
formatters.setup({
{ command = "black", filetypes = { "python" } },
-- other formatters for other languages go in this list
})
vim.opt_local.wrap = true
vim.api.nvim_set_keymap('v', '<leader>lf', '<cmd>lua vim.lsp.buf.format()<CR>', { noremap = true, silent = true })
vim.g.editorconfig = false
lvim.builtin.telescope.pickers.buffers.sort_mru = true
lvim.builtin.telescope.pickers.buffers.ignore_current_buffer = true
-- Clangd specific settings.
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "clangd" })
local clangd_flags = {
"--fallback-style=google",
"--background-index",
"-j=12",
"--all-scopes-completion",
"--pch-storage=disk",
"--clang-tidy",
"--log=error",
"--completion-style=detailed",
"--header-insertion=iwyu",
"--header-insertion-decorators",
"--enable-config",
"--offset-encoding=utf-16",
"--ranking-model=heuristics",
"--folding-ranges",
}
local clangd_bin = "clangd"
local opts = {
cmd = { clangd_bin, unpack(clangd_flags) },
}
require("lvim.lsp.manager").setup("clangd", opts)
-- Change it to point to iree-mlir-lsp-server.
-- Has support to more dialects and operations.
local mlir_options = {
cmd = { "iree-mlir-lsp-server" },
}
require("lvim.lsp.manager").setup("mlir_lsp_server", mlir_options)
require("lvim.lsp.manager").setup("tblgen_lsp_server")
require("lvim.lsp.manager").setup("mlir_pdll_lsp_server")
-- Add the mlir filetype.
vim.cmd [[ autocmd BufRead,BufNewFile *.mlir set filetype=mlir ]]
-- Add the new required plugins.
lvim.plugins = {
{
"christoomey/vim-tmux-navigator",
event = "VimEnter",
config = function()
vim.g.tmux_navigator_no_mappings = 0
end,
},
{
"cappyzawa/trim.nvim",
config = function()
require("trim").setup({})
end
},
{
"zbirenbaum/copilot-cmp",
event = "InsertEnter",
dependencies = { "zbirenbaum/copilot.lua" },
config = function()
vim.defer_fn(function()
require("copilot").setup() -- https://github.com/zbirenbaum/copilot.lua/blob/master/README.md#setup-and-configuration
require("copilot_cmp").setup() -- https://github.com/zbirenbaum/copilot-cmp/blob/master/README.md#configuration
end, 100)
end,
}
}
-- Search in the current buffer.
lvim.builtin.which_key.mappings["t"] = {
"<cmd>Telescope current_buffer_fuzzy_find<CR>", "Current buffer fuzzy."
}
-- Renames the symbol under the cursor. ALso, renames the references.
vim.api.nvim_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', { noremap = true, silent = true })
-- Awesome floating terminal.
lvim.builtin.terminal.open_mapping = "<c-t>"
require('trim').setup({
-- if you want to ignore markdown file.
-- you can specify filetypes.
ft_blocklist = {"markdown"},
-- if you want to remove multiple blank lines
patterns = {
[[%s/\(\n\n\)\n\+/\1/]], -- replace multiple blank lines with a single line
},
-- if you want to disable trim on write by default
trim_on_write = true,
-- highlight trailing spaces
highlight = false
})