Compare commits
1 Commits
e65a7f3f13
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 713af0f937 |
@@ -29,6 +29,39 @@ vim.api.nvim_create_user_command('MessagesToBuffer', function()
|
|||||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||||
end, { desc = 'Open :messages output in a scratch buffer' })
|
end, { desc = 'Open :messages output in a scratch buffer' })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('CmdToBuffer', function(opts)
|
||||||
|
local cmd = table.concat(opts.fargs, ' ')
|
||||||
|
|
||||||
|
vim.g.__cmd_to_buffer_cmd = cmd
|
||||||
|
vim.g.__cmd_to_buffer_out = nil
|
||||||
|
|
||||||
|
local exec_line = opts.bang and 'silent execute' or 'execute'
|
||||||
|
local ok, err = pcall(vim.cmd, string.format(
|
||||||
|
[[
|
||||||
|
redir => g:__cmd_to_buffer_out
|
||||||
|
%s g:__cmd_to_buffer_cmd
|
||||||
|
redir END
|
||||||
|
]],
|
||||||
|
exec_line
|
||||||
|
))
|
||||||
|
if not ok then
|
||||||
|
pcall(vim.cmd, 'redir END')
|
||||||
|
error(err)
|
||||||
|
end
|
||||||
|
|
||||||
|
local output = vim.g.__cmd_to_buffer_out or ''
|
||||||
|
vim.g.__cmd_to_buffer_cmd = nil
|
||||||
|
vim.g.__cmd_to_buffer_out = nil
|
||||||
|
local lines = vim.split(output, '\n', { plain = true, trimempty = false })
|
||||||
|
|
||||||
|
vim.cmd('new')
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
vim.bo[bufnr].buftype = 'nofile'
|
||||||
|
vim.bo[bufnr].bufhidden = 'wipe'
|
||||||
|
vim.bo[bufnr].swapfile = false
|
||||||
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||||
|
end, { nargs = '+', bang = true, complete = 'command', desc = 'Run an Ex command and open its output in a scratch buffer' })
|
||||||
|
|
||||||
-- Automatically create a scratch buffer if Neovim starts with no files
|
-- Automatically create a scratch buffer if Neovim starts with no files
|
||||||
au('VimEnter', {
|
au('VimEnter', {
|
||||||
group = group,
|
group = group,
|
||||||
|
|||||||
@@ -22,6 +22,15 @@ vim.keymap.set('x', 'K', ":m '<-2<CR>gv=gv")
|
|||||||
|
|
||||||
vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]])
|
vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]])
|
||||||
|
|
||||||
|
-- Scroll
|
||||||
|
-- vim.keymap.set('n', '<C-d>', function()
|
||||||
|
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'j')
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
-- vim.keymap.set('n', '<C-u>', function()
|
||||||
|
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'k')
|
||||||
|
-- end)
|
||||||
|
|
||||||
-- Easy to use registers
|
-- Easy to use registers
|
||||||
map('x', '<leader>p', '"_dP')
|
map('x', '<leader>p', '"_dP')
|
||||||
map({ 'n', 'x' }, '<leader>y', '"+y')
|
map({ 'n', 'x' }, '<leader>y', '"+y')
|
||||||
@@ -38,6 +47,7 @@ map('n', '<C-k>', '<C-w>k')
|
|||||||
-- Tab management
|
-- Tab management
|
||||||
map('n', ']t', cmd('tabnext'))
|
map('n', ']t', cmd('tabnext'))
|
||||||
map('n', '[t', cmd('tabprevious'))
|
map('n', '[t', cmd('tabprevious'))
|
||||||
|
map('n', '<leader>t', '<nop>')
|
||||||
map('n', '<leader>tt', cmd('tabnew'))
|
map('n', '<leader>tt', cmd('tabnew'))
|
||||||
map('n', '<leader>tn', cmd('tabnew'))
|
map('n', '<leader>tn', cmd('tabnew'))
|
||||||
map('n', '<leader>tc', cmd('tabclose'))
|
map('n', '<leader>tc', cmd('tabclose'))
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ vim.opt.autoindent = true -- Copy indent from the current line when starting a n
|
|||||||
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
|
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
|
||||||
|
|
||||||
-- Scroll and mouse
|
-- Scroll and mouse
|
||||||
|
vim.opt.scroll = 20
|
||||||
vim.opt.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
vim.opt.sidescrolloff = 5
|
vim.opt.sidescrolloff = 5
|
||||||
vim.opt.mousescroll = 'hor:1,ver:1'
|
vim.opt.mousescroll = 'hor:1,ver:1'
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ function M.get()
|
|||||||
{ 'https://github.com/mfussenegger/nvim-lint' },
|
{ 'https://github.com/mfussenegger/nvim-lint' },
|
||||||
{ 'https://github.com/stevearc/conform.nvim' },
|
{ 'https://github.com/stevearc/conform.nvim' },
|
||||||
|
|
||||||
|
{ 'https://github.com/tpope/vim-fugitive' },
|
||||||
|
|
||||||
-- { 'https://github.com/MeanderingProgrammer/render-markdown.nvim' },
|
-- { 'https://github.com/MeanderingProgrammer/render-markdown.nvim' },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"mason.nvim":{"hash":"44d1e90e1f66e077268191e3ee9d2ac97cc18e65","name":"mason.nvim","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","url":"https://github.com/mason-org/mason.nvim"},"paq-nvim":{"hash":"971344d1fe1fd93580961815e7b7c8853c3605e4","name":"paq-nvim","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","url":"https://github.com/savq/paq-nvim.git"},"invero.nvim":{"hash":"639d89d8599bdb68d01097e57dcea9ba3dc18e96","name":"invero.nvim","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","url":"https://github.com/triimd/invero.nvim"},"nvim-autopairs":{"hash":"007047febaa3681a8d2f3dd5126fdb9c6e81f393","name":"nvim-autopairs","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","url":"https://github.com/windwp/nvim-autopairs"},"nvim-lint":{"hash":"b3292aac30b935d4cccf0904053d1c7930df8a20","name":"nvim-lint","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","url":"https://github.com/mfussenegger/nvim-lint"},"nvim-ts-autotag":{"hash":"db15f2e0df2f5db916e511e3fffb682ef2f6354f","name":"nvim-ts-autotag","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","url":"https://github.com/windwp/nvim-ts-autotag"},"nvim-tree.lua":{"hash":"7c0f7e906ab6f11b61eec52171eaf7dc06726ef1","name":"nvim-tree.lua","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua"},"nvim-treesitter":{"hash":"42fc28ba918343ebfd5565147a42a26580579482","name":"nvim-treesitter","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","url":"https://github.com/nvim-treesitter/nvim-treesitter"},"render-markdown.nvim":{"hash":"","name":"render-markdown.nvim","status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/render-markdown.nvim","url":"https://github.com/MeanderingProgrammer/render-markdown.nvim"},"conform.nvim":{"hash":"c2526f1cde528a66e086ab1668e996d162c75f4f","name":"conform.nvim","status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","url":"https://github.com/stevearc/conform.nvim"}}
|
{"nvim-autopairs":{"name":"nvim-autopairs","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","status":0,"url":"https://github.com/windwp/nvim-autopairs","hash":"59bce2eef357189c3305e25bc6dd2d138c1683f5"},"nvim-tree.lua":{"name":"nvim-tree.lua","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","status":0,"url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua","hash":"7c0f7e906ab6f11b61eec52171eaf7dc06726ef1"},"nvim-treesitter":{"name":"nvim-treesitter","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","status":0,"url":"https://github.com/nvim-treesitter/nvim-treesitter","hash":"42fc28ba918343ebfd5565147a42a26580579482"},"nvim-lint":{"name":"nvim-lint","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","status":0,"url":"https://github.com/mfussenegger/nvim-lint","hash":"bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81"},"paq-nvim":{"name":"paq-nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","status":0,"url":"https://github.com/savq/paq-nvim.git","hash":"971344d1fe1fd93580961815e7b7c8853c3605e4"},"invero.nvim":{"name":"invero.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","status":0,"url":"https://github.com/triimd/invero.nvim","hash":"1a1761f4f4444d3b9b9e87308a33c0b043e209d3"},"mason.nvim":{"name":"mason.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","status":0,"url":"https://github.com/mason-org/mason.nvim","hash":"44d1e90e1f66e077268191e3ee9d2ac97cc18e65"},"vim-fugitive":{"name":"vim-fugitive","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/vim-fugitive","status":1,"url":"https://github.com/tpope/vim-fugitive","hash":""},"nvim-ts-autotag":{"name":"nvim-ts-autotag","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","status":0,"url":"https://github.com/windwp/nvim-ts-autotag","hash":"8e1c0a389f20bf7f5b0dd0e00306c1247bda2595"},"conform.nvim":{"name":"conform.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","status":0,"url":"https://github.com/stevearc/conform.nvim","hash":"c2526f1cde528a66e086ab1668e996d162c75f4f"}}
|
||||||
Reference in New Issue
Block a user