-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
142 lines (123 loc) · 4.08 KB
/
init.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
-- Install plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"git@github.com:folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- Neovide configuration
vim.o.guifont = "Dejavu Sans Mono:h7:#e-subpixelantialias"
vim.g.neovide_scale_factor = 0.5
vim.g.neovide_scroll_animation_length = 0.1
vim.g.neovide_cursor_animation_length = 0
vim.g.neovide_cursor_trail_size = 0
-- Core settings
vim.g.mapleader = ","
vim.o.number = true
vim.o.mouse = "a"
vim.o.mousemodel = "extend"
vim.o.shortmess = "c"
vim.o.concealcursor = ""
vim.o.textwidth = 120
vim.o.listchars = "tab:»·,trail:·"
vim.o.list = true
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.laststatus = 3
vim.g.rustfmt_autosave = false
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:,diff:╱]]
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.termguicolors = true
vim.o.background = "dark"
vim.o.colorcolumn = "120"
vim.o.cursorline = true
vim.o.showmatch = true
vim.o.winblend = 0
vim.o.pumblend = 0
vim.o.scrolloff = 10
vim.o.fixendofline = true
vim.o.clipboard = "unnamed"
-- spaces, tabs, indent
vim.o.smarttab = true
vim.o.expandtab = false
vim.o.softtabstop = 8
vim.o.tabstop = 8
vim.o.shiftwidth = 8
vim.o.smartindent = true
vim.o.autoindent = true
vim.o.wrap = true
vim.opt.formatoptions:remove('t')
-- lazy plugins
local plugins = {
{ "catppuccin/nvim", priority = 1000 },
{ "nvim-treesitter/nvim-treesitter", name = "treesitter" },
{ 'nvim-treesitter/nvim-treesitter-textobjects' }, -- Additional textobjects for treesitter
{ "nvim-lua/plenary.nvim" },
{ "sindrets/diffview.nvim" },
{ "NeogitOrg/neogit", tag = 'v1.0.0', config = true },
{ "lewis6991/gitsigns.nvim", config = true },
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', config = true },
{ 'neovim/nvim-lspconfig' }, -- Collection of configurations for built-in LSP client
{ 'p00f/clangd_extensions.nvim', config = true },
{ 'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'},
{ 'hrsh7th/cmp-nvim-lsp'},
{ 'hrsh7th/nvim-cmp'},
{ 'L3MON4D3/LuaSnip'},
{ "MysticalDevil/inlay-hints.nvim", config = true },
{ "kwkarlwang/bufresize.nvim", config = true }, -- resize the split when resizing the terminal
}
require("lazy").setup(plugins, opts)
-- theme
vim.cmd.colorscheme "catppuccin"
-- trailing whitespace hilighting
vim.cmd.syn "on"
vim.g.show_whitespace = 1
if vim.g.show_whitespace then
local ag = vim.api.nvim_create_augroup('show_whitespace', { clear = true })
vim.api.nvim_create_autocmd('Syntax', {
pattern = '*',
command = [[syntax match TrailingWS /\v\s\ze\s*$/ containedin=ALL]],
group = ag,
})
vim.cmd [[highlight TrailingWS ctermbg=203 ctermfg=203 guibg=IndianRed1 guifg=IndianRed1]]
end
-- completion
vim.o.completeopt = "menu,menuone,noinsert"
-- telescope
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
-- neovide
if vim.g.neovide == true then
local function set_scale(scale)
vim.g.neovide_scale_factor = scale
-- Force redraw, otherwise the scale change won't be rendered until the next UI update
vim.cmd.redraw { bang = true }
end
vim.keymap.set("n", "<C-=>", function() set_scale(vim.g.neovide_scale_factor + 0.1) end)
vim.keymap.set("n", "<C-->", function() set_scale(vim.g.neovide_scale_factor - 0.1) end)
vim.keymap.set("n", "<C-0>", function() set_scale(.5) end)
end
-- lsp
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
lsp_zero.set_server_config({
on_init = function(client)
client.server_capabilities.semanticTokensProvider = nil
end,
})
require 'lspconfig'.clangd.setup{}