Skip to content

Commit 9936f43

Browse files
committed
add indent_line and simplify uv
1 parent 29efb5d commit 9936f43

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

init.lua

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ vim.g.mapleader = ' '
33
vim.g.maplocalleader = ' '
44
vim.g.have_nerd_font = true
55

6-
local function nvim_ver(major, minor)
7-
local version = vim.version()
8-
return (version.major > major or version.minor >= minor)
9-
end
10-
11-
-- fs_stat moves based on version :(
12-
local fs_stat = function(path)
13-
if nvim_ver(0, 10) then
14-
return vim.uv.fs_stat(path)
15-
end
16-
return vim.loop.fs_stat(path)
17-
end
18-
196
-- Margins
207
vim.opt.title = false -- in status, not great with tmux
218
vim.opt.number = true -- show line number
@@ -92,8 +79,9 @@ vim.api.nvim_create_autocmd('TextYankPost', {
9279

9380
-- Install Lazy from Github
9481
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
82+
local uv = vim.uv or vim.loop
9583

96-
if not fs_stat(lazypath) then
84+
if not uv.fs_stat(lazypath) then
9785
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
9886
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
9987
if vim.v.shell_error ~= 0 then
@@ -106,6 +94,7 @@ vim.opt.rtp:prepend(lazypath)
10694
require('lazy').setup({
10795

10896
require 'plugins.indentguess', -- Detects tabstop and shiftwidth to match orig
97+
require 'plugins.indent_line', -- Mark indent with vertical ruler (default as toggle off)
10998
require 'plugins.neovimacs', -- Emacs-style keybindings while in insert mode
11099
require 'plugins.gitsigns', -- Add git changes to gutter
111100
require 'plugins.which-key', -- Show keybindings as you go

lua/plugins/indent_line.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
return {
2+
{ -- Add indentation guides even on blank lines
3+
'lukas-reineke/indent-blankline.nvim',
4+
main = 'ibl',
5+
config = function()
6+
-- passing as an option does not work correctly at present w/ toggle
7+
require('ibl').setup {}
8+
require('ibl').update { enabled = false }
9+
end,
10+
keys = {
11+
{ '<Leader>ib', '<cmd>IBLToggle<cr>', desc = 'Indent lines toggle' },
12+
},
13+
},
14+
}

0 commit comments

Comments
 (0)