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" })
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
vim.o.syntax = "on"
|
||||
vim.o.expandtab = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.smarttab = true
|
||||
vim.o.smartindent = true
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.colorcolumn = "100"
|
||||
vim.o.bg = "dark"
|
||||
vim.g.mapleader = " "
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
local ok, builtin = pcall(require, "telescope.builtin")
|
||||
if not ok then
|
||||
print("failed to load telescope.builtin")
|
||||
return
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
local ok, telescope = pcall(require, "telescope")
|
||||
if not ok then
|
||||
print("failed to load telescope")
|
||||
return
|
||||
end
|
||||
|
||||
telescope.setup {
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
vim.lsp.enable('pyright')
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
local ok, theme = pcall(require, "vscode")
|
||||
if not ok then
|
||||
print("failed to load vscode theme")
|
||||
return
|
||||
end
|
||||
|
||||
theme.setup{
|
||||
transparent = true,
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme "vscode"
|
||||
@@ -1,8 +0,0 @@
|
||||
local ok, treesitter = pcall(require, "nvim-treesitter")
|
||||
if not ok then
|
||||
print("ERROR: treesitter couldn't be loaded")
|
||||
return
|
||||
end
|
||||
|
||||
treesitter.install { 'lua' }
|
||||
|
||||
40
.config/nvim/nvim-pack-lock.json
Normal file
40
.config/nvim/nvim-pack-lock.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"plugins": {
|
||||
"cmp-nvim-lsp": {
|
||||
"rev": "cbc7b02bb99fae35cb42f514762b89b5126651ef",
|
||||
"src": "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
"nvim-autopairs": {
|
||||
"rev": "59bce2eef357189c3305e25bc6dd2d138c1683f5",
|
||||
"src": "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
"nvim-cmp": {
|
||||
"rev": "da88697d7f45d16852c6b2769dc52387d1ddc45f",
|
||||
"src": "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "66fd02ad1c7ea31616d3ca678fa04e6d0b360824",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "45a07f869b0cffba342276f2c77ba7c116d35db8",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
"telescope-fzf-native.nvim": {
|
||||
"rev": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c",
|
||||
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
"telescope.nvim": {
|
||||
"rev": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc",
|
||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
"vague.nvim": {
|
||||
"rev": "c1ab4d4891ff3a27deba6a80222d895ac8ffb2e5",
|
||||
"src": "https://github.com/vague-theme/vague.nvim"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user