Add neovim config

This commit is contained in:
Maciej Jur 2023-07-10 13:46:48 +02:00
commit 790777c009
No known key found for this signature in database
GPG key ID: ADA3BF323198C639
8 changed files with 144 additions and 0 deletions

23
nvim/init.lua Normal file
View file

@ -0,0 +1,23 @@
-- Setup global config
require("global")
-- Load lazy.nvim package 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",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Set up plugins
plugins = require("plugins")
lazy = require("lazy")
lazy.setup(plugins)

11
nvim/lazy-lock.json Normal file
View file

@ -0,0 +1,11 @@
{
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
"lazy.nvim": { "branch": "main", "commit": "da8b00581a52f5f87ad2aba9f52171fda7491f18" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"nvim-lspconfig": { "branch": "master", "commit": "deade69789089c3da15237697156334fb3e943f0" },
"nvim-treesitter": { "branch": "master", "commit": "f2efc5f35743b8383a1b50f727faae94658506d5" },
"nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" },
"plenary.nvim": { "branch": "master", "commit": "bda256fab0eb66a15e8190937e417e6a14ee5d72" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"telescope.nvim": { "branch": "master", "commit": "276362a8020c6e94c7a76d49aa00d4923b0c02f3" }
}

View file

@ -0,0 +1,15 @@
return function()
local configs = require("lspconfig")
local on_attach = function(client, buf_number)
local buf_opts = { noremap = true, silent = true, buffer = buf_number }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, buf_opts)
end
configs.tsserver.setup({
on_attach = on_attach
})
configs.astro.setup({
on_attach = on_attach
})
end

View file

@ -0,0 +1,5 @@
return function()
local config = require("lualine")
config.setup({})
end

View file

@ -0,0 +1,8 @@
return function()
local configs = require("presence").setup({
main_image = "file",
buttons = false,
show_time = false,
})
end

View file

@ -0,0 +1,29 @@
return function()
local configs = require("nvim-treesitter.configs");
configs.setup({
ensure_installed = {
-- nvim
"vim", "vimdoc", "lua",
-- shell
"bash", -- "nu",
-- rust
"rust", "toml",
-- python
"python",
-- webdev
"html", "css", "scss", "typescript", "tsx", "astro",
-- markdown
"markdown",
-- nix
"nix",
-- latex
"latex", "bibtex",
-- misc
"gitignore", "yaml", "regex",
},
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end

19
nvim/lua/global.lua Normal file
View file

@ -0,0 +1,19 @@
local g = vim.g
local o = vim.o
local opt = vim.opt
-- Indentation
opt.tabstop = 2
opt.smartindent = true
opt.shiftwidth = 2
opt.expandtab = true
-- Line numbers
opt.number = true
vim.filetype.add({
extension = {
mdx = "mdx"
}
})

34
nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,34 @@
return {
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"neovim/nvim-lspconfig",
config = require "configs/lspconfig",
},
{
"nvim-treesitter/nvim-treesitter",
config = require "configs/treesitter",
build = ":TSUpdate",
init = function()
vim.treesitter.language.register("markdown", "mdx")
end
},
{
"andweeb/presence.nvim",
config = require "configs/presence",
},
{
"nvim-lualine/lualine.nvim",
config = require "configs/lualine",
dependencies = { "nvim-tree/nvim-web-devicons" },
},
{
"rebelot/kanagawa.nvim",
init = function()
vim.cmd("colorscheme kanagawa")
end
}
}