mirror of
https://github.com/WarrenHood/dotfiles.git
synced 2025-04-30 00:04:59 +01:00
Add barbar and some keybinds
This commit is contained in:
parent
ecdb771957
commit
ecfed038ac
|
@ -3,10 +3,9 @@ local function map(m, k, v, opts)
|
||||||
if not opts['silent'] then
|
if not opts['silent'] then
|
||||||
opts['silent'] = true
|
opts['silent'] = true
|
||||||
end
|
end
|
||||||
vim.keymap.set(m, k, v, opts)
|
vim.keymap.set(m, k, v, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Save and Quit
|
-- Save and Quit
|
||||||
map('n', '<C-Q>', ':wq<CR>')
|
map('n', '<C-Q>', ':wq<CR>')
|
||||||
map('i', '<C-Q>', '<ESC>:wq<CR>')
|
map('i', '<C-Q>', '<ESC>:wq<CR>')
|
||||||
|
@ -18,8 +17,8 @@ map('i', '<C-S>', '<ESC>:w<CR>')
|
||||||
-- Telescope
|
-- Telescope
|
||||||
local telescope_builtin = require('telescope.builtin')
|
local telescope_builtin = require('telescope.builtin')
|
||||||
map('n', '<leader>ff', telescope_builtin.find_files, { desc = 'Find Files' })
|
map('n', '<leader>ff', telescope_builtin.find_files, { desc = 'Find Files' })
|
||||||
map('n', '<leader>fg', telescope_builtin.live_grep, { desc = 'Live Grep'})
|
map('n', '<leader>fg', telescope_builtin.live_grep, { desc = 'Live Grep' })
|
||||||
map('n', '<leader>fb', telescope_builtin.buffers, { desc = 'Find Buffers'})
|
map('n', '<leader>fb', telescope_builtin.buffers, { desc = 'Find Buffers' })
|
||||||
map('n', '<leader>fh', telescope_builtin.help_tags, { desc = 'Help Tags' })
|
map('n', '<leader>fh', telescope_builtin.help_tags, { desc = 'Help Tags' })
|
||||||
|
|
||||||
-- NvimTree Toggle (File Explorer)
|
-- NvimTree Toggle (File Explorer)
|
||||||
|
@ -82,7 +81,7 @@ map("n", "<Leader>di", ":lua require('dapui').toggle()<CR>")
|
||||||
|
|
||||||
|
|
||||||
-- luasnip
|
-- luasnip
|
||||||
vim.cmd[[
|
vim.cmd [[
|
||||||
" Use Tab to expand and jump through snippets
|
" Use Tab to expand and jump through snippets
|
||||||
imap <silent><expr> <C-k> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
|
imap <silent><expr> <C-k> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
|
||||||
smap <silent><expr> <C-k> luasnip#jumpable(1) ? '<Plug>luasnip-jump-next' : '<Tab>'
|
smap <silent><expr> <C-k> luasnip#jumpable(1) ? '<Plug>luasnip-jump-next' : '<Tab>'
|
||||||
|
@ -95,7 +94,53 @@ smap <silent><expr> <C-j> luasnip#jumpable(-1) ? '<Plug>luasnip-jump-prev' : '<S
|
||||||
-- GUI (Neovide
|
-- GUI (Neovide
|
||||||
-- Toggle fullscreen in Neovide with Alt + Enter)
|
-- Toggle fullscreen in Neovide with Alt + Enter)
|
||||||
if vim.g.neovide then
|
if vim.g.neovide then
|
||||||
map({"n", "i", "t"}, "<A-CR>", function ()
|
map({ "n", "i", "t" }, "<A-CR>", function()
|
||||||
vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen
|
vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- barbar
|
||||||
|
local barbar_opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
-- Move to previous/next
|
||||||
|
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', barbar_opts)
|
||||||
|
map('n', '<A-.>', '<Cmd>BufferNext<CR>', barbar_opts)
|
||||||
|
-- Re-order to previous/next
|
||||||
|
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', barbar_opts)
|
||||||
|
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', barbar_opts)
|
||||||
|
-- Goto buffer in position...
|
||||||
|
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', barbar_opts)
|
||||||
|
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', barbar_opts)
|
||||||
|
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', barbar_opts)
|
||||||
|
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', barbar_opts)
|
||||||
|
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', barbar_opts)
|
||||||
|
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', barbar_opts)
|
||||||
|
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', barbar_opts)
|
||||||
|
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', barbar_opts)
|
||||||
|
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', barbar_opts)
|
||||||
|
map('n', '<A-0>', '<Cmd>BufferLast<CR>', barbar_opts)
|
||||||
|
-- Pin/unpin buffer
|
||||||
|
map('n', '<A-p>', '<Cmd>BufferPin<CR>', barbar_opts)
|
||||||
|
-- Close buffer
|
||||||
|
map('n', '<A-c>', '<Cmd>BufferClose<CR>', barbar_opts)
|
||||||
|
-- Wipeout buffer
|
||||||
|
-- :BufferWipeout
|
||||||
|
|
||||||
|
-- Close commands
|
||||||
|
-- :BufferCloseAllButCurrent
|
||||||
|
-- :BufferCloseAllButPinned
|
||||||
|
-- :BufferCloseAllButCurrentOrPinned
|
||||||
|
-- :BufferCloseBuffersLeft
|
||||||
|
-- :BufferCloseBuffersRight
|
||||||
|
-- Magic buffer-picking mode
|
||||||
|
map('n', '<C-p>', '<Cmd>BufferPick<CR>', barbar_opts)
|
||||||
|
-- Sort automatically by...
|
||||||
|
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', barbar_opts)
|
||||||
|
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', barbar_opts)
|
||||||
|
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', barbar_opts)
|
||||||
|
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', barbar_opts)
|
||||||
|
|
||||||
|
-- Other:
|
||||||
|
-- :BarbarEnable - enables barbar (enabled by default)
|
||||||
|
-- :BarbarDisable - very bad command, should never be used
|
||||||
|
|
|
@ -146,7 +146,11 @@ require("packer").startup(function()
|
||||||
end
|
end
|
||||||
} -- Virtual text for nvim-dap
|
} -- Virtual text for nvim-dap
|
||||||
|
|
||||||
|
-- Tab
|
||||||
|
use {
|
||||||
|
'romgrk/barbar.nvim',
|
||||||
|
requires = {'kyazdani42/nvim-web-devicons'},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- Automatically set up configuration after cloning packer.nvim
|
-- Automatically set up configuration after cloning packer.nvim
|
||||||
|
|
Loading…
Reference in a new issue