Update config + add user command to align markdown tables
This commit is contained in:
parent
f02d74c282
commit
80e0df74c9
15
init.lua
15
init.lua
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
@ -155,9 +155,10 @@ vim.opt.inccommand = 'split'
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
vim.opt.scrolloff = 5
|
||||
|
||||
vim.opt.linebreak = true
|
||||
vim.opt.fixeol = false
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
@ -199,6 +200,16 @@ vim.keymap.set('n', '<leader>pv', vim.cmd.Ex, { desc = 'File explorer' })
|
||||
vim.keymap.set('n', '<C-j>', vim.cmd.cnext, { desc = 'Quick fix list next' })
|
||||
vim.keymap.set('n', '<C-k>', vim.cmd.cprev, { desc = 'Quick fix list previous' })
|
||||
|
||||
-- [[ User Commands ]]
|
||||
|
||||
-- Align markdown table
|
||||
vim.api.nvim_create_user_command('MDTableAlign', function(args)
|
||||
print(args.line1 .. '-' .. args.line2 .. ' pizzas')
|
||||
local command = string.format("%d,%d! tr -s \" \" | column -t -s '|' -o '|'", args.line1, args.line2)
|
||||
vim.cmd('silent ' .. command)
|
||||
--vim.cmd("! tr -s \" \" | column -t -s '|' -o '|'")
|
||||
end, { range = true, bang = false })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user