working nvf!
This commit is contained in:
parent
5548480371
commit
2a80c2bac1
53 changed files with 330 additions and 172 deletions
4
modules/editors/nvf/runtime/after/ftplugin/envrc.lua
Normal file
4
modules/editors/nvf/runtime/after/ftplugin/envrc.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- luacheck: ignore
|
||||
vim.filetype.add({
|
||||
filename = { ['.envrc'] = 'bash' },
|
||||
})
|
2
modules/editors/nvf/runtime/after/ftplugin/gitcommit.lua
Normal file
2
modules/editors/nvf/runtime/after/ftplugin/gitcommit.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.textwidth = 80
|
5
modules/editors/nvf/runtime/after/ftplugin/go.lua
Normal file
5
modules/editors/nvf/runtime/after/ftplugin/go.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 0
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.list = false
|
14
modules/editors/nvf/runtime/after/ftplugin/json.lua
Normal file
14
modules/editors/nvf/runtime/after/ftplugin/json.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
vim.keymap.set('n', '<leader>jf', '<cmd>%!jq<cr>', { noremap = true, silent = true, desc = 'Format with jq' })
|
||||
vim.keymap.set('n', '<leader>jm', '<cmd>%!jq -c<cr>', { noremap = true, silent = true, desc = 'Minify with jq' })
|
||||
|
||||
-- add comma to the end of the line on new line
|
||||
vim.keymap.set('n', 'o', function()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
|
||||
local should_add_comma = string.find(line, '[^,{[]$')
|
||||
if should_add_comma then
|
||||
return 'A,<cr>'
|
||||
else
|
||||
return 'o'
|
||||
end
|
||||
end, { buffer = true, expr = true })
|
13
modules/editors/nvf/runtime/after/ftplugin/man.lua
Normal file
13
modules/editors/nvf/runtime/after/ftplugin/man.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- luacheck: ignore
|
||||
local opts = { noremap = true, silent = true, buffer = 0 }
|
||||
local wincmd = vim.b.pager and 'q' or 'c'
|
||||
vim.keymap.set('n', 'q', '<cmd>lclose<CR><C-W>' .. wincmd, opts)
|
||||
vim.keymap.set('n', '<Leader>o', function()
|
||||
-- TODO: can this be done in a floating window?
|
||||
require('man').show_toc()
|
||||
end, opts)
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
|
||||
.. (vim.b.undo_ftplugin ~= nil and ' | ' or '')
|
||||
.. 'sil! nunmap <buffer> <Leader>o'
|
||||
.. ' | sil! nunmap <buffer> q'
|
30
modules/editors/nvf/runtime/after/ftplugin/markdown.lua
Normal file
30
modules/editors/nvf/runtime/after/ftplugin/markdown.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.textwidth = 80
|
||||
|
||||
local CR = vim.api.nvim_replace_termcodes('<cr>', true, true, true)
|
||||
local function toggle_checkbox()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local lineno = cursor[1]
|
||||
local line = vim.api.nvim_buf_get_lines(0, lineno - 1, lineno, false)[1] or ''
|
||||
if string.find(line, '%[ %]') then
|
||||
line = line:gsub('%[ %]', '%[x%]')
|
||||
else
|
||||
line = line:gsub('%[x%]', '%[ %]')
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(0, lineno - 1, lineno, false, { line })
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
pcall(vim.fn['repeat#set'], ':ToggleCheckbox' .. CR)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'ToggleCheckbox',
|
||||
toggle_checkbox,
|
||||
vim.tbl_extend('force', { desc = 'toggle checkboxes' }, {})
|
||||
)
|
||||
|
||||
vim.keymap.set('n', '<leader>op', toggle_checkbox, {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'Toggle checkbox',
|
||||
buffer = 0,
|
||||
})
|
2
modules/editors/nvf/runtime/after/ftplugin/qf.lua
Normal file
2
modules/editors/nvf/runtime/after/ftplugin/qf.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.wo.wrap = true
|
2
modules/editors/nvf/runtime/after/ftplugin/xml.lua
Normal file
2
modules/editors/nvf/runtime/after/ftplugin/xml.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.shiftwidth = 2
|
Loading…
Add table
Add a link
Reference in a new issue