From 9936f43124c95ad2219a6b45ea38b419d76dd891 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Sat, 7 Dec 2024 12:44:06 -0500 Subject: [PATCH] add indent_line and simplify uv --- init.lua | 17 +++-------------- lua/plugins/indent_line.lua | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 lua/plugins/indent_line.lua diff --git a/init.lua b/init.lua index 23b42ce0..28ffe43b 100644 --- a/init.lua +++ b/init.lua @@ -3,19 +3,6 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.have_nerd_font = true -local function nvim_ver(major, minor) - local version = vim.version() - return (version.major > major or version.minor >= minor) -end - --- fs_stat moves based on version :( -local fs_stat = function(path) - if nvim_ver(0, 10) then - return vim.uv.fs_stat(path) - end - return vim.loop.fs_stat(path) -end - -- Margins vim.opt.title = false -- in status, not great with tmux vim.opt.number = true -- show line number @@ -92,8 +79,9 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- Install Lazy from Github local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +local uv = vim.uv or vim.loop -if not fs_stat(lazypath) then +if not uv.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 @@ -106,6 +94,7 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ require 'plugins.indentguess', -- Detects tabstop and shiftwidth to match orig + require 'plugins.indent_line', -- Mark indent with vertical ruler (default as toggle off) require 'plugins.neovimacs', -- Emacs-style keybindings while in insert mode require 'plugins.gitsigns', -- Add git changes to gutter require 'plugins.which-key', -- Show keybindings as you go diff --git a/lua/plugins/indent_line.lua b/lua/plugins/indent_line.lua new file mode 100644 index 00000000..90589e4f --- /dev/null +++ b/lua/plugins/indent_line.lua @@ -0,0 +1,14 @@ +return { + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + config = function() + -- passing as an option does not work correctly at present w/ toggle + require('ibl').setup {} + require('ibl').update { enabled = false } + end, + keys = { + { 'ib', 'IBLToggle', desc = 'Indent lines toggle' }, + }, + }, +}