-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate from packer.nvim to lazy.nvim [1/n]
use single-file setup; todo: cleanup after packer directory mess
- Loading branch information
Showing
6 changed files
with
312 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
-- Bootstrap lazy.nvim | ||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | ||
if not (vim.uv or vim.loop).fs_stat(lazypath) then | ||
local lazyrepo = "https://github.com/folke/lazy.nvim.git" | ||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) | ||
if vim.v.shell_error ~= 0 then | ||
vim.api.nvim_echo({ | ||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" }, | ||
{ out, "WarningMsg" }, | ||
{ "\nPress any key to exit..." }, | ||
}, true, {}) | ||
vim.fn.getchar() | ||
os.exit(1) | ||
end | ||
end | ||
vim.opt.rtp:prepend(lazypath) | ||
|
||
-- Make sure to setup `mapleader` and `maplocalleader` before | ||
-- loading lazy.nvim so that mappings are correct. | ||
-- This is also a good place to setup other settings (vim.opt) | ||
vim.g.mapleader = " " | ||
vim.g.maplocalleader = "\\" | ||
|
||
-- Setup lazy.nvim | ||
require("lazy").setup({ | ||
spec = { | ||
-- import your plugins | ||
--{ import = "plugins.packerSpecs" }, | ||
{ | ||
'nvim-telescope/telescope.nvim', | ||
version = '0.1.8', | ||
-- or, branch = '0.1.x', | ||
dependencies = { {'nvim-lua/plenary.nvim'} } | ||
}, | ||
|
||
|
||
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', }, | ||
{ 'mbbill/undotree' }, | ||
{ 'ms-jpq/coq_nvim', branch = 'coq' }, | ||
|
||
-- 9000+ Snippets | ||
{ 'ms-jpq/coq.artifacts', branch = 'artifacts'}, | ||
|
||
-- " lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty | ||
-- " Need to **configure separately** | ||
{ 'ms-jpq/coq.thirdparty', branch = '3p' }, | ||
-- " - shell repl | ||
-- " - nvim lua api | ||
-- " - scientific calculator | ||
-- " - comment banner | ||
-- " - etc | ||
|
||
|
||
-- "=====> https://github.com/andweeb/presence.nvim | ||
-- { 'andweeb/presence.nvim' } | ||
|
||
{ | ||
"andweeb/presence.nvim", | ||
config = function() | ||
require("presence"):setup({ | ||
-- General options | ||
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) | ||
neovim_image_text = ":ZZ", -- Text displayed when hovered over the Neovim image | ||
main_image = "neovim", -- Main image display (either "neovim" or "file") | ||
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) | ||
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") | ||
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`) | ||
enable_line_number = false, -- Displays the current line number instead of the current project | ||
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches | ||
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table) | ||
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference) | ||
show_time = true, -- Show the timer | ||
|
||
-- Rich Presence text options | ||
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string) | ||
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string) | ||
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string) | ||
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string) | ||
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string) | ||
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string) | ||
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string) | ||
}) | ||
end, | ||
}, | ||
|
||
|
||
-- "=====> ncm-R for Rscripts completion | ||
{ 'ncm2/ncm2' }, | ||
{ 'roxma/nvim-yarp' }, | ||
{ 'jalvesaq/Nvim-R' }, | ||
{ 'gaalcaras/ncm-R' }, | ||
|
||
|
||
-- "====> rust-analyzer dependencies | ||
|
||
-- " Use release branch (recommend) | ||
-- use ('neoclide/coc.nvim', {branch = 'master'}) | ||
-- " Or build from source code by using yarn: https://yarnpkg.com | ||
-- use ('neoclide/coc.nvim', { | ||
-- branch = 'master', | ||
-- run = 'yarn install --frozen-lockfile' | ||
-- }) | ||
|
||
-- " nvim-jdtls | ||
{ 'mfussenegger/nvim-jdtls' }, | ||
|
||
|
||
|
||
-- " Vim 8 only | ||
-- uncomment on vim.init | ||
-- if !has('nvim') | ||
-- use ('roxma/vim-hug-neovim-rpc') | ||
-- endif | ||
|
||
-- Optional: for snippet support | ||
-- Further configuration might be required, read below | ||
{ 'sirver/UltiSnips' }, | ||
{ 'ncm2/ncm2-ultisnips' }, | ||
|
||
-- " Optional: better Rnoweb support (LaTeX completion) | ||
{ 'lervag/vimtex' }, | ||
|
||
-- lsp-zero | ||
{ | ||
'VonHeikemen/lsp-zero.nvim', | ||
branch = 'v3.x', | ||
dependencies = { | ||
--- Uncomment these if you want to manage LSP servers from neovim | ||
{'williamboman/mason.nvim'}, | ||
{'williamboman/mason-lspconfig.nvim'}, | ||
|
||
-- LSP Support | ||
{'neovim/nvim-lspconfig'}, | ||
|
||
-- Autocompletion | ||
{'hrsh7th/nvim-cmp'}, | ||
{'hrsh7th/cmp-nvim-lsp'}, | ||
{'L3MON4D3/LuaSnip'}, | ||
|
||
}, | ||
}, | ||
|
||
-- nvim-platformio | ||
{ | ||
'anurag3301/nvim-platformio.lua', | ||
dependencies = { | ||
{'akinsho/nvim-toggleterm.lua'}, | ||
{'nvim-telescope/telescope.nvim'}, | ||
{'nvim-lua/plenary.nvim'}, | ||
}, | ||
}, | ||
}, | ||
-- Configure any other settings here. See the documentation for more details. | ||
-- colorscheme that will be used when installing plugins. | ||
install = { colorscheme = { "habamax" } }, | ||
-- automatically check for plugin updates | ||
checker = { enabled = true }, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,7 @@ | ||
require("user.remap") | ||
require("tools") | ||
require("settings") -- user.set | ||
require("user.packer") | ||
|
||
vim.opt.runtimepath:prepend("~/.vim") -- counterpart of :set^=, prepend or add before all characters | ||
vim.opt.runtimepath:append ("~/.vim/after") -- counterpart of :set+=, append or add after all characters | ||
vim.o.packpath = vim.o.runtimepath | ||
--require("~/.vimrc") | ||
|
||
-- check ./lua/user/packer.lua for installed plugins | ||
|
||
-- python interpreter path from virtualenv | ||
vim.g.python3_host_prog = "$HOME/.config/nvim/venv_nvim/neovim3/bin/python" | ||
|
||
-- lsp | ||
-- Mason Setup | ||
--require("mason").setup({ | ||
-- ui = { | ||
-- icons = { | ||
-- package_installed = "", | ||
-- package_pending = "", | ||
-- package_uninstalled = "", | ||
-- }, | ||
-- } | ||
--}) | ||
--require("mason-lspconfig").setup() | ||
-- | ||
local lsp_zero = require('lsp-zero') | ||
|
||
lsp_zero.on_attach(function(client, bufnr) | ||
local opts = {buffer = bufnr, remap = false} | ||
|
||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) | ||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) | ||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) | ||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) | ||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) | ||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) | ||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) | ||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) | ||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) | ||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) | ||
end) | ||
|
||
require('mason').setup({ | ||
log_level = vim.log.levels.DEBUG | ||
}) | ||
require('mason-lspconfig').setup({ | ||
ensure_installed = {'tsserver', 'rust_analyzer', 'eslint', }, | ||
handlers = { | ||
lsp_zero.default_setup, | ||
lua_ls = function() | ||
local lua_opts = lsp_zero.nvim_lua_ls() | ||
require('lspconfig').lua_ls.setup(lua_opts) | ||
end, | ||
} | ||
}) | ||
|
||
local cmp = require('cmp') | ||
local cmp_select = {behavior = cmp.SelectBehavior.Select} | ||
|
||
cmp.setup({ | ||
sources = { | ||
{name = 'path'}, | ||
{name = 'nvim_lsp'}, | ||
{name = 'nvim_lua'}, | ||
}, | ||
formatting = lsp_zero.cmp_format(), | ||
mapping = cmp.mapping.preset.insert({ | ||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), | ||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select), | ||
['<C-y>'] = cmp.mapping.confirm({ select = true }), | ||
['<C-Space>'] = cmp.mapping.complete(), | ||
['<C-k>'] = cmp.mapping.scroll_docs(-4), | ||
['<C-j>'] = cmp.mapping.scroll_docs(4) | ||
}), | ||
}) | ||
|
||
-- | ||
-- | ||
--require("settings") -- user.set | ||
--require("user.packer") | ||
require("config.lazy") | ||
--require("plugins.packerSpecs") -- Ensure the plugins are loaded. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim | ||
|
||
-- Only required if you have packer configured as `opt` | ||
vim.cmd [[packadd packer.nvim]] | ||
-- vim.cmd [[packadd packer.nvim]] | ||
|
||
return require('packer').startup(function(use) | ||
-- return require('packer').startup(function(use) | ||
-- Packer can manage itself | ||
use 'wbthomason/packer.nvim' | ||
-- use 'wbthomason/packer.nvim' | ||
|
||
use { | ||
'nvim-telescope/telescope.nvim', | ||
tag = '0.1.3', | ||
-- use { | ||
-- 'nvim-telescope/telescope.nvim', | ||
-- tag = '0.1.3', | ||
-- or, branch = '0.1.x', | ||
requires = { {'nvim-lua/plenary.nvim'} } | ||
} | ||
use | ||
-- requires = { {'nvim-lua/plenary.nvim'} } | ||
-- } | ||
|
||
end) | ||
--end) | ||
|
||
-- check ./lua/user/packer.lua for installed plugins |
Oops, something went wrong.