-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
88 lines (70 loc) · 2.26 KB
/
init.lua
File metadata and controls
88 lines (70 loc) · 2.26 KB
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
print("Hello World") --required
vim.g.mapleader = " "
vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/nvim-telescope/telescope.nvim", tag = "*", dependicies = "nvim-lia/plenary.nvim" },
{ src = "https://github.com/chomosuke/typst-preview.nvim.git" },
{ src = "https://github.com/folke/tokyonight.nvim.git" },
{ src = "https://github.com/mason-org/mason.nvim.git" }
})
--require('config.plugins.telescope')
require('config.plugins.typst-preview')
require("mason").setup()
vim.opt.shiftwidth = 4
vim.opt.clipboard = "unnamedplus"
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.wrap = false
vim.opt.tabstop = 4
vim.opt.swapfile = false
vim.opt.signcolumn = "yes"
vim.opt.winborder = "double"
local map = vim.keymap.set
map('n', '<leader>pv', vim.cmd.Ex)
map('n', '<leader>o', ':update<CR> :source<CR>')
--map('t', '^[', "^\^N")
--map('t', '^O', "^\^O")
vim.lsp.config['lua_ls'] = {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true)
}
}
}
}
vim.lsp.config['clangd'] = {
cmd = { 'clangd' },
rootmarkers = { '.clangd', 'compile_commands.json' },
filestypes = { 'c', 'cpp' }
}
vim.lsp.config['tinymist'] = {
cmd = { 'tinymist' },
filetypes = { 'typst' },
settings = {
formatterMode = "typstyle"
}
}
vim.lsp.enable({ "lua_ls", "clangd", "tinymist" })
map('n', '<leader>lf', vim.lsp.buf.format)
vim.cmd[[colorscheme tokyonight-night]]
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('my.lsp', {}),
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client:supports_method('textDocument/completion') then
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
client.server_capabilities.completionProvider.triggerCharacters = chars
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
end
end,
})
map('n', '<leader>e', vim.diagnostic.open_float)
vim.cmd [[set completeopt+=menuone,noselect,popup]]