From 8f4406002f78ac6bedb16778f1dd8fffea895934 Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Sat, 29 Jul 2023 21:15:17 +0200 Subject: [PATCH] feat: add bufferline --- nvim/README.md | 4 +++ nvim/init.lua | 43 +++++++++++++++++++++------------ nvim/lazy-lock.json | 11 +++++---- nvim/lua/configs/rust-tools.lua | 4 +-- nvim/lua/global.lua | 8 +++--- nvim/lua/neovide.lua | 2 ++ nvim/lua/plugins.lua | 17 ++++++++++++- 7 files changed, 60 insertions(+), 29 deletions(-) create mode 100644 nvim/README.md create mode 100644 nvim/lua/neovide.lua diff --git a/nvim/README.md b/nvim/README.md new file mode 100644 index 0000000..ab41e65 --- /dev/null +++ b/nvim/README.md @@ -0,0 +1,4 @@ +| Key | Action | +| ------------- | ------------------------- | +| `pm` | open package manager | + diff --git a/nvim/init.lua b/nvim/init.lua index f40d5d4..7464891 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,23 +1,34 @@ -- 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, - }) +-- Setup Neovide config +-- Only run this if inside Neovide +if vim.g.neovide then + require("neovide") end -vim.opt.rtp:prepend(lazypath) --- Set up plugins -plugins = require("plugins") -lazy = require("lazy") +-- Bootstrap package manager +do + 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) +end -lazy.setup(plugins) +-- Load lazy +local lazy_ok, lazy = pcall(require, "lazy") +if lazy_ok then + lazy.setup(require("plugins")) + vim.keymap.set('n', 'pm', lazy.home, { desc = "Package manager: open" }) +else + print("(init) Couldn't load Lazy") +end diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0fe907c..276b858 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,26 +1,27 @@ { "LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" }, + "bufferline.nvim": { "branch": "main", "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "diffview.nvim": { "branch": "main", "commit": "e91110d2a7f8e2f667666aba6ea089ff823f8748" }, - "gitsigns.nvim": { "branch": "main", "commit": "11b80e7eea249affc8776483272bcfc627b5552a" }, + "gitsigns.nvim": { "branch": "main", "commit": "5d73da785a3c05fd63ac31769079db05169a6ec7" }, "haskell-tools.nvim": { "branch": "1.x.x", "commit": "43ec3b2f068c8163476dbb0c35bcb8ad7d588fa4" }, "kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" }, "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" }, - "mason.nvim": { "branch": "main", "commit": "5e58cdbcde0469d487873e531c71ef97df821adb" }, + "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "981a43adcca25e7ccc3c589902d49f25e4d48ebc" }, "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" }, "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, - "nvim-dap": { "branch": "master", "commit": "d17d1bba23ec72a157bd183c57840c39e323f515" }, + "nvim-dap": { "branch": "master", "commit": "2f28ea843bcdb378b171a66ddcd568516e431d55" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, - "nvim-lspconfig": { "branch": "master", "commit": "6f426c34c8e21af2f934e56be9d1198a507ecc9f" }, - "nvim-treesitter": { "branch": "master", "commit": "74a7da4e4be5ee71e9efb6d7bdffa16ad620cc57" }, + "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, + "nvim-treesitter": { "branch": "master", "commit": "ee107fc759647293a84ad42b867f518331364fbe" }, "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, diff --git a/nvim/lua/configs/rust-tools.lua b/nvim/lua/configs/rust-tools.lua index 879d5cd..a043a08 100644 --- a/nvim/lua/configs/rust-tools.lua +++ b/nvim/lua/configs/rust-tools.lua @@ -12,7 +12,7 @@ return function() standalone = true, -- capabilities = capabilities, on_attach = function(client, bufnr) - local buf_opts = { noremap = true, silent = true, buffer = buf_number } + local buf_opts = { noremap = true, silent = true, buffer = bufnr } vim.keymap.set('n', "", rt.hover_actions.hover_actions, buf_opts) vim.keymap.set('n', "a", rt.code_action_group.code_action_group, buf_opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, buf_opts) @@ -24,7 +24,7 @@ return function() command = "clippy", allFeatures = true, } - } + } }, dap = { adapter = require("rust-tools.dap").get_codelldb_adapter(lsp_path, lib_path), diff --git a/nvim/lua/global.lua b/nvim/lua/global.lua index 0169715..1cb58d4 100644 --- a/nvim/lua/global.lua +++ b/nvim/lua/global.lua @@ -13,21 +13,19 @@ opt.expandtab = true -- Line numbers opt.number = true +opt.relativenumber = true -- Clipboard opt.clipboard = "unnamedplus" -- Helper punctuation -vim.opt.list = true -vim.opt.listchars = { +opt.list = true +opt.listchars = { trail = '·', nbsp = '␣', tab = '→→', } --- Neovide -g.neovide_scale_factor = 0.75 - -- Trailing whitespace -- vim.fn.matchadd("errorMsg", [[\s\+$]]) vim.api.nvim_create_autocmd("BufWritePre", { command = [[%s/\s\+$//e]] }) diff --git a/nvim/lua/neovide.lua b/nvim/lua/neovide.lua new file mode 100644 index 0000000..4a8bc39 --- /dev/null +++ b/nvim/lua/neovide.lua @@ -0,0 +1,2 @@ +vim.g.neovide_scale_factor = 0.75 + diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 3cd0302..8d638dd 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -49,6 +49,19 @@ return { end, }, + -- Bufferline + { + 'akinsho/bufferline.nvim', + version = "*", + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, + config = function() + local config = require("bufferline") + config.setup({}) + end + }, + -- Git diffviewer { "sindrets/diffview.nvim", @@ -92,7 +105,9 @@ return { -- nvim "vim", "vimdoc", "lua", -- misc - "comment", "gitignore", "diff", "dockerfile", "json", "yaml", "toml", "regex", + "comment", "dockerfile", "json", "yaml", "toml", "regex", + -- git + "gitcommit", "gitignore", "diff", -- shell "bash", -- "fish", "nu", -- markdown