switch from hx to nvim, use rose pine theme
This commit is contained in:
158
.config/nvim/init.lua
Normal file
158
.config/nvim/init.lua
Normal file
@@ -0,0 +1,158 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/site/pack/packer/start/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
config = function()
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
opts = {},
|
||||
lazy = false,
|
||||
},
|
||||
{ "lewis6991/gitsigns.nvim" },
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
})
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body) -- Use LuaSnip for snippets
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
||||
["<Tab>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-Space>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" }, -- LSP completion
|
||||
{ name = "buffer" }, -- Buffer completion
|
||||
{ name = "path" }, -- Path completion
|
||||
{ name = "luasnip" }, -- Snippet completion
|
||||
},
|
||||
})
|
||||
|
||||
-- nvim-lspconfig - Providing basic, default Nvim LSP client configurations for various LSP servers.
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.pyright.setup({})
|
||||
lspconfig.ts_ls.setup({})
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
local luasnip = require("luasnip")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip").config.set_config({
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
})
|
||||
|
||||
-- line numbers
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Comment.vim - Smart and Powerful commenting plugin for neovim
|
||||
require("Comment").setup()
|
||||
|
||||
-- conform.nvim - Lightweight yet powerful formatter plugin for neovim
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
rust = { "rustfmt" },
|
||||
javascript = { "prettier" },
|
||||
html = { "prettier" },
|
||||
go = { "gofmt" },
|
||||
bash = { "shfmt" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
|
||||
-- Hyprlang LSP
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.hl", "hypr*.conf" },
|
||||
callback = function(event)
|
||||
vim.lsp.start({
|
||||
name = "hyprlang",
|
||||
cmd = { "hyprls" },
|
||||
root_dir = vim.fn.getcwd(),
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- enable diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = "▎",
|
||||
},
|
||||
severity_sort = true,
|
||||
float = {
|
||||
source = "always",
|
||||
},
|
||||
})
|
||||
|
||||
-- save and format on insertleave
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "FocusLost" }, {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
require("conform").format()
|
||||
vim.cmd("silent! write")
|
||||
end,
|
||||
})
|
||||
|
||||
-- aliases
|
||||
vim.keymap.set("ca", "o", "tabnew")
|
||||
|
||||
-- remove editor background
|
||||
-- vim.cmd([[
|
||||
-- highlight Normal guibg=none
|
||||
-- highlight NonText guibg=none
|
||||
-- highlight Normal ctermbg=none
|
||||
-- highlight NonText ctermbg=none
|
||||
-- ]])
|
Reference in New Issue
Block a user