From 790777c009d70a884d5ea6d268b72ca690433c61 Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Mon, 10 Jul 2023 13:46:48 +0200 Subject: [PATCH] Add neovim config --- nvim/init.lua | 23 ++++++++++++++++++++++ nvim/lazy-lock.json | 11 +++++++++++ nvim/lua/configs/lspconfig.lua | 15 +++++++++++++++ nvim/lua/configs/lualine.lua | 5 +++++ nvim/lua/configs/presence.lua | 8 ++++++++ nvim/lua/configs/treesitter.lua | 29 ++++++++++++++++++++++++++++ nvim/lua/global.lua | 19 ++++++++++++++++++ nvim/lua/plugins.lua | 34 +++++++++++++++++++++++++++++++++ 8 files changed, 144 insertions(+) create mode 100644 nvim/init.lua create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/configs/lspconfig.lua create mode 100644 nvim/lua/configs/lualine.lua create mode 100644 nvim/lua/configs/presence.lua create mode 100644 nvim/lua/configs/treesitter.lua create mode 100644 nvim/lua/global.lua create mode 100644 nvim/lua/plugins.lua diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..f40d5d4 --- /dev/null +++ b/nvim/init.lua @@ -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) + diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..b9fd292 --- /dev/null +++ b/nvim/lazy-lock.json @@ -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" } +} \ No newline at end of file diff --git a/nvim/lua/configs/lspconfig.lua b/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..8959fbd --- /dev/null +++ b/nvim/lua/configs/lspconfig.lua @@ -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 + diff --git a/nvim/lua/configs/lualine.lua b/nvim/lua/configs/lualine.lua new file mode 100644 index 0000000..814fb9e --- /dev/null +++ b/nvim/lua/configs/lualine.lua @@ -0,0 +1,5 @@ +return function() + local config = require("lualine") + config.setup({}) +end + diff --git a/nvim/lua/configs/presence.lua b/nvim/lua/configs/presence.lua new file mode 100644 index 0000000..df01c6f --- /dev/null +++ b/nvim/lua/configs/presence.lua @@ -0,0 +1,8 @@ +return function() + local configs = require("presence").setup({ + main_image = "file", + buttons = false, + show_time = false, + }) +end + diff --git a/nvim/lua/configs/treesitter.lua b/nvim/lua/configs/treesitter.lua new file mode 100644 index 0000000..52fffc8 --- /dev/null +++ b/nvim/lua/configs/treesitter.lua @@ -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 + diff --git a/nvim/lua/global.lua b/nvim/lua/global.lua new file mode 100644 index 0000000..8e0a1de --- /dev/null +++ b/nvim/lua/global.lua @@ -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" + } +}) + diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000..ffe3ce2 --- /dev/null +++ b/nvim/lua/plugins.lua @@ -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 + } +} +