feat: light and beautiful neovim config (only 0.12 support for now)
This commit is contained in:
@@ -1,15 +1,107 @@
|
||||
require('config')
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.wrap = false
|
||||
vim.o.winborder = "rounded"
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = false
|
||||
vim.o.smartindent = true
|
||||
vim.o.swapfile = false
|
||||
vim.g.mapleader = " "
|
||||
|
||||
require "paq" {
|
||||
"savq/paq-nvim", -- Let Paq manage itself
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make -j16" },
|
||||
{ "nvim-treesitter/nvim-treesitter", branch = "main" },
|
||||
'Mofiqul/vscode.nvim',
|
||||
'neovim/nvim-lspconfig',
|
||||
vim.keymap.set("n", "<leader>o", ":update<CR>:source<CR>")
|
||||
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format)
|
||||
vim.keymap.set("n", "<leader>ff", ":Telescope find_files<CR>")
|
||||
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<CR>")
|
||||
vim.keymap.set("n", "<leader>n", ":noh<CR>")
|
||||
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/vague-theme/vague.nvim" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
{ src = "nvim-telescope/telescope-fzf-native.nvim" },
|
||||
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
|
||||
{ src = "https://github.com/hrsh7th/nvim-cmp" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-nvim-lsp" },
|
||||
{ src = "https://github.com/windwp/nvim-autopairs" },
|
||||
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" }
|
||||
})
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath('config')
|
||||
and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc'))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most
|
||||
-- likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Tell the language server how to find Lua modules same way as Neovim
|
||||
-- (see `:h lua-module-load`)
|
||||
path = {
|
||||
'lua/?.lua',
|
||||
'lua/?/init.lua',
|
||||
},
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
})
|
||||
|
||||
local cmp = require 'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end
|
||||
},
|
||||
preselect = cmp.PreselectMode.Item,
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }
|
||||
}, { name = 'buffer' })
|
||||
})
|
||||
|
||||
require("vague").setup {
|
||||
transparent = true,
|
||||
italic = false,
|
||||
}
|
||||
|
||||
require('treesitter')
|
||||
require('finder')
|
||||
require('lsp')
|
||||
require('theme')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
vim.o.colorcolumn = "80"
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.enable({ "lua_ls", "clangd" })
|
||||
vim.cmd("colorscheme vague")
|
||||
|
||||
require 'nvim-autopairs'.setup {}
|
||||
require 'nvim-treesitter'.install({ "c", "cpp", "rust", "lua", "javascript", "typescript" })
|
||||
|
||||
Reference in New Issue
Block a user