dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 0cb5bd9e7dc80e4ac678ae1fad0dc29241a66905
parent 8b30a279bf4dcd551d87784d08089bb86dabedcb
Author: Chris Bracken <chris@bracken.jp>
Date:   Sat, 24 Aug 2024 17:31:37 -0700

vim: migrate packages from vim-plug to lazy.nvim

vim-plug worked great, but given that I've moved my config to a
Lua-based config, lazy.nvim has a few nice features that I may as well
take advantage of, such as:

* Ability to specify a config() callback.
* Easier to make config more modular.

Diffstat:
M.config/nvim/init.lua | 30++++++------------------------
A.config/nvim/lazy-lock.json | 12++++++++++++
A.config/nvim/lua/config/colorscheme.lua | 37+++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/config/lazy.lua | 29+++++++++++++++++++++++++++++
M.config/nvim/lua/config/options.lua | 45+++++++--------------------------------------
D.config/nvim/lua/plugins.lua | 25-------------------------
A.config/nvim/lua/plugins/languages.lua | 29+++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/solarized-osaka.lua | 9+++++++++
A.config/nvim/lua/plugins/utilities.lua | 5+++++
M.gitignore | 3---
M.lldbinit | 1+
DMakefile | 5-----
12 files changed, 135 insertions(+), 95 deletions(-)

diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -1,25 +1,7 @@ --- Plugin management with vim-plug. -vim.cmd [[ -call plug#begin() -" Colour scheme. -Plug 'craftzdog/solarized-osaka.nvim' +-- Core configuration options. +require('config.colorscheme') +require('config.keymappings') +require('config.options') -" Formatting. -Plug 'rhysd/vim-clang-format' " clang-format. - -" Language support plugins. -Plug 'https://gn.googlesource.com/gn', { 'rtp': 'misc/vim' } -Plug 'nathangrigg/vim-beancount' -Plug 'rust-lang/rust.vim' -Plug 'neovim/nvim-lspconfig' - -" Behaviour. -Plug 'ibhagwan/fzf-lua' -Plug 'tpope/vim-fugitive' -Plug 'lewis6991/gitsigns.nvim' -call plug#end() -]] - -require('core.options') -require('core.keymappings') -require('plugins') +-- Package manager. +require('config.lazy') diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json @@ -0,0 +1,12 @@ +{ + "fzf-lua": { "branch": "main", "commit": "1ac27d5734ccd057ef2b46a8644022913f37b89e" }, + "gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" }, + "gn": { "branch": "main", "commit": "225e90c5025bf74f41dbee60d9cde4512c846fe7" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "nvim-lspconfig": { "branch": "master", "commit": "911167921d49cd5c1c9b2436031d0da3945e787f" }, + "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, + "solarized-osaka.nvim": { "branch": "main", "commit": "126d394c0c979a99206214a2b6b8c86e456c9c0f" }, + "vim-beancount": { "branch": "master", "commit": "25bcbc773554b5798d253a1a5fa5de158792f95e" }, + "vim-clang-format": { "branch": "master", "commit": "6b791825ff478061ad1c57b21bb1ed5a5fd0eb29" }, + "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" } +} diff --git a/.config/nvim/lua/config/colorscheme.lua b/.config/nvim/lua/config/colorscheme.lua @@ -0,0 +1,37 @@ +vim.opt.background = 'dark' +if vim.fn.has('termguicolors') == 1 then + vim.opt.cursorline = true -- Highlight cursor line, max column. + vim.opt.termguicolors = true -- Enable 24-bit colour. + + vim.api.nvim_create_autocmd({'WinLeave'}, { + pattern = '*', + command = 'setlocal nocursorline' + }) + vim.api.nvim_create_autocmd({'WinEnter'}, { + pattern = '*', + command = 'setlocal cursorline' + }) + vim.api.nvim_create_autocmd({'BufLeave'}, { + pattern = '*', + command = 'setlocal nocursorline' + }) + vim.api.nvim_create_autocmd({'BufEnter'}, { + pattern = '*', + command = 'setlocal cursorline' + }) + + -- Highlight over-length lines. + vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { + pattern = '*', + command = 'set colorcolumn=80' + }) + vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { + pattern = {'*.txt', '*.md'}, + command = 'set colorcolumn=80 | set textwidth=80' + }) + vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { + pattern = {'*.java', '*.m', '*.mm'}, + command = 'set colorcolumn=100 | set textwidth=100' + }) +end + diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,29 @@ +-- 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) + +-- Set up lazy.nvim. +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "solarized-osaka" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua @@ -35,41 +35,10 @@ vim.api.nvim_create_autocmd('FileType', { end }) --- Configure colour scheme and syntax highlighting. -vim.opt.background = 'dark' -if vim.fn.has('termguicolors') == 1 then - vim.opt.cursorline = true -- Highlight cursor line, max column. - vim.opt.termguicolors = true -- Enable 24-bit colour. - vim.cmd('colorscheme solarized-osaka') - - vim.api.nvim_create_autocmd({'WinLeave'}, { - pattern = '*', - command = 'setlocal nocursorline' - }) - vim.api.nvim_create_autocmd({'WinEnter'}, { - pattern = '*', - command = 'setlocal cursorline' - }) - vim.api.nvim_create_autocmd({'BufLeave'}, { - pattern = '*', - command = 'setlocal nocursorline' - }) - vim.api.nvim_create_autocmd({'BufEnter'}, { - pattern = '*', - command = 'setlocal cursorline' - }) - - -- Highlight over-length lines. - vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { - pattern = '*', - command = 'set colorcolumn=80' - }) - vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { - pattern = {'*.txt', '*.md'}, - command = 'set colorcolumn=80 | set textwidth=80' - }) - vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave'}, { - pattern = {'*.java', '*.m', '*.mm'}, - command = 'set colorcolumn=100 | set textwidth=100' - }) -end +-- Don't show warnings, errors, etc. by default. +vim.diagnostic.config({ + virtual_text = false, + signs = false, + underline = false, + update_in_insert = false, +}); diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua @@ -1,25 +0,0 @@ --- Git add/modify/removed signs in the gutter. -require('gitsigns').setup({}) - --- Language server configuration. -local lspconfig = require('lspconfig') -lspconfig.clangd.setup({}) -lspconfig.dartls.setup({}) -lspconfig.rust_analyzer.setup({}) -lspconfig.sourcekit.setup({ - capabilities = { - workspace = { - didChangeWatchedFiles = { - dynamicRegistration = true, - }, - }, - }, -}) - --- Don't show warnings, errors, etc. by default. -vim.diagnostic.config({ - virtual_text = false, - signs = false, - underline = false, - update_in_insert = false, -}); diff --git a/.config/nvim/lua/plugins/languages.lua b/.config/nvim/lua/plugins/languages.lua @@ -0,0 +1,29 @@ +return { + { + "https://gn.googlesource.com/gn", + config = function(plugin) + vim.opt.rtp:append(plugin.dir .. "/misc/vim") + end + }, + { "nathangrigg/vim-beancount" }, + { + "neovim/nvim-lspconfig", + config = function(plugin) + local lspconfig = require('lspconfig') + lspconfig.clangd.setup({}) + lspconfig.dartls.setup({}) + lspconfig.rust_analyzer.setup({}) + lspconfig.sourcekit.setup({ + capabilities = { + workspace = { + didChangeWatchedFiles = { + dynamicRegistration = true, + }, + }, + }, + }) + end + }, + { "rhysd/vim-clang-format" }, + { "rust-lang/rust.vim" }, +} diff --git a/.config/nvim/lua/plugins/solarized-osaka.lua b/.config/nvim/lua/plugins/solarized-osaka.lua @@ -0,0 +1,9 @@ +return { + "craftzdog/solarized-osaka.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function(plugin) + vim.cmd('colorscheme solarized-osaka') + end +} diff --git a/.config/nvim/lua/plugins/utilities.lua b/.config/nvim/lua/plugins/utilities.lua @@ -0,0 +1,5 @@ +return { + { "ibhagwan/fzf-lua" }, + { "lewis6991/gitsigns.nvim" }, + { "tpope/vim-fugitive" }, +} diff --git a/.gitignore b/.gitignore @@ -40,9 +40,6 @@ .config/iterm2/AppSupport # nvim -.config/nvim/autoload/plug.vim -.config/nvim/autoload/plug.vim.old -.config/nvim/plugged .config/nvim/.netrwhist .config/nvim/*.spl .config/nvim/*.sug diff --git a/.lldbinit b/.lldbinit @@ -1,2 +1,3 @@ settings set -g target.inline-breakpoint-strategy always settings set target.x86-disassembly-flavor intel +settings set target.source-map "flutter/" "/Users/chris/Developer/flutter/engine/src/flutter/" diff --git a/Makefile b/Makefile @@ -1,5 +0,0 @@ -CONFIG_DIR=~/.config/nvim - -vim-plug: - curl -fLo ${CONFIG_DIR}/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim