vim win-shift lib

master
Dustin Swan 2 years ago
parent 1b4e32679f
commit 50b01b5a0e
Signed by: dustinswan
GPG Key ID: AB49BD6B2B3A6377

@ -20,317 +20,339 @@ vim.opt.laststatus = 3 -- global status line
vim.api.nvim_create_autocmd('FileType', { pattern = 'org', command = 'setlocal nowrap' }) vim.api.nvim_create_autocmd('FileType', { pattern = 'org', command = 'setlocal nowrap' })
vim.api.nvim_create_autocmd('TextYankPost', { vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*', pattern = '*',
callback = function() callback = function()
vim.highlight.on_yank { higroup = 'IncSearch' } vim.highlight.on_yank { higroup = 'IncSearch' }
end, end,
}) })
local ensure_packer = function() local ensure_packer = function()
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return true return true
end end
return false return false
end end
local packer_bootstrap = ensure_packer() local packer_bootstrap = ensure_packer()
require('packer').startup(function(use) require('packer').startup(function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'tpope/vim-surround' use 'tpope/vim-surround'
use 'tpope/vim-repeat' use 'tpope/vim-repeat'
use 'felipec/vim-sanegx' use 'felipec/vim-sanegx'
use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' } use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' }
use 'folke/neodev.nvim' use 'folke/neodev.nvim'
use 'jamessan/vim-gnupg' use 'jamessan/vim-gnupg'
use 'dhruvasagar/vim-table-mode' use 'dhruvasagar/vim-table-mode'
use 'mfussenegger/nvim-dap' use 'mfussenegger/nvim-dap'
use 'lukas-reineke/indent-blankline.nvim' use 'lukas-reineke/indent-blankline.nvim'
use 'LnL7/vim-nix' use 'LnL7/vim-nix'
use 'AndrewRadev/splitjoin.vim' use 'AndrewRadev/splitjoin.vim'
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
branch = '0.1.x', branch = '0.1.x',
requires = { 'nvim-lua/plenary.nvim' } requires = { 'nvim-lua/plenary.nvim' }
} }
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
} }
use { 'nvim-orgmode/orgmode', config = function() use { 'nvim-orgmode/orgmode', config = function()
require('orgmode').setup_ts_grammar() require('orgmode').setup_ts_grammar()
require 'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
highlight = { highlight = {
enable = true, enable = true,
additional_vim_regex_highlighting = { 'org' }, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar additional_vim_regex_highlighting = { 'org' }, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar
}, },
ensure_installed = { 'org' }, -- Or run :TSUpdate org ensure_installed = { 'org' }, -- Or run :TSUpdate org
} }
require('orgmode').setup({ require('orgmode').setup({
org_agenda_files = { '~/Sync/Notes/*' }, org_agenda_files = { '~/Sync/Notes/*' },
org_default_notes_file = '~/Sync/Notes/Main.org', org_default_notes_file = '~/Sync/Notes/Main.org',
}) })
end } end }
use { use {
"catppuccin/nvim", "catppuccin/nvim",
as = "catppuccin", as = "catppuccin",
config = function() config = function()
require("catppuccin").setup { require("catppuccin").setup {
flavour = "mocha", -- mocha, macchiato, frappe, latte flavour = "mocha", -- mocha, macchiato, frappe, latte
transparent_background = true transparent_background = true
} }
vim.api.nvim_command "colorscheme catppuccin" vim.api.nvim_command "colorscheme catppuccin"
end end
} }
use { use {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = function() config = function()
require('gitsigns').setup() require('gitsigns').setup()
end end
} }
use { use {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }, requires = { 'kyazdani42/nvim-web-devicons', opt = true },
config = function() require('lualine').setup() end config = function() require('lualine').setup() end
} }
use { use {
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() config = function()
require("which-key").setup({ require("which-key").setup({
plugins = { plugins = {
spelling = { spelling = {
enabled = true enabled = true
} }
} }
}) })
end end
} }
use { use {
'akinsho/bufferline.nvim', 'akinsho/bufferline.nvim',
ag = "v3.*", ag = "v3.*",
requires = 'kyazdani42/nvim-web-devicons', requires = 'kyazdani42/nvim-web-devicons',
config = function() config = function()
require("bufferline").setup() require("bufferline").setup()
end end
} }
use 'nvim-tree/nvim-web-devicons' use 'nvim-tree/nvim-web-devicons'
use { use {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
branch = "v2.x", branch = "v2.x",
requires = { requires = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
} }
} }
use({ use({
"folke/noice.nvim", "folke/noice.nvim",
event = "VimEnter", event = "VimEnter",
config = function() config = function()
require("noice").setup() require("noice").setup()
require("notify").setup({ require("notify").setup({
background_colour = "#000000" background_colour = "#000000"
}) })
end, end,
requires = { requires = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
} }
}) })
use { use {
'VonHeikemen/lsp-zero.nvim', 'VonHeikemen/lsp-zero.nvim',
requires = { requires = {
-- LSP Support -- LSP Support
{ 'neovim/nvim-lspconfig' }, { 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' }, { 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' }, { 'williamboman/mason-lspconfig.nvim' },
-- Autocompletion -- Autocompletion
{ 'hrsh7th/nvim-cmp' }, { 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' }, { 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' }, { 'hrsh7th/cmp-path' },
{ 'saadparwaiz1/cmp_luasnip' }, { 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' }, { 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' }, { 'hrsh7th/cmp-nvim-lua' },
-- Snippets -- Snippets
{ 'L3MON4D3/LuaSnip' }, { 'L3MON4D3/LuaSnip' },
{ 'rafamadriz/friendly-snippets' }, { 'rafamadriz/friendly-snippets' },
}, },
config = function() config = function()
local lsp = require('lsp-zero') local lsp = require('lsp-zero')
lsp.preset('recommended') lsp.preset('recommended')
lsp.setup() lsp.setup()
end end
} }
use { use {
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function() config = function()
require('Comment').setup({ require('Comment').setup({
toggler = { toggler = {
line = '<leader>cc', line = '<leader>cc',
block = '<leader>cb', block = '<leader>cb',
}, },
opleader = { opleader = {
line = '<leader>cc', line = '<leader>cc',
block = '<leader>cb', block = '<leader>cb',
} }
}) })
end end
} }
use { use {
'JoosepAlviste/nvim-ts-context-commentstring', 'JoosepAlviste/nvim-ts-context-commentstring',
config = function() config = function()
require 'nvim-treesitter.configs'.setup({ require 'nvim-treesitter.configs'.setup({
context_commentstring = { context_commentstring = {
enable = true enable = true
} }
}) })
end end
} }
use { use {
'goolord/alpha-nvim', 'goolord/alpha-nvim',
requires = { 'kyazdani42/nvim-web-devicons' }, requires = { 'kyazdani42/nvim-web-devicons' },
config = function() config = function()
require 'alpha'.setup(require 'alpha.themes.startify'.config) require 'alpha'.setup(require 'alpha.themes.startify'.config)
end end
} }
use { use {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
config = function() config = function()
require("nvim-autopairs").setup {} require("nvim-autopairs").setup {}
end end
} }
use { use {
'alexghergh/nvim-tmux-navigation', config = function() 'alexghergh/nvim-tmux-navigation', config = function()
require 'nvim-tmux-navigation'.setup { require 'nvim-tmux-navigation'.setup {
keybindings = { keybindings = {
left = "<C-h>", left = "<C-h>",
down = "<C-j>", down = "<C-j>",
up = "<C-k>", up = "<C-k>",
right = "<C-l>", right = "<C-l>",
last_active = "<C-\\>", last_active = "<C-\\>",
next = "<C-Space>", next = "<C-Space>",
} }
} }
end end
} }
use { use {
'jose-elias-alvarez/null-ls.nvim', 'jose-elias-alvarez/null-ls.nvim',
config = function() config = function()
require("null-ls").setup({ require("null-ls").setup({
-- sources = { -- sources = {
-- require("null-ls").builtins.formatting.stylua, -- require("null-ls").builtins.formatting.stylua,
-- require("null-ls").builtins.diagnostics.eslint, -- require("null-ls").builtins.diagnostics.eslint,
-- require("null-ls").builtins.completion.spell, -- require("null-ls").builtins.completion.spell,
-- }, -- },
}) })
end, end,
requires = { "nvim-lua/plenary.nvim" } requires = { "nvim-lua/plenary.nvim" }
} }
use { use {
"akinsho/toggleterm.nvim", tag = '*', config = function() "akinsho/toggleterm.nvim", tag = '*', config = function()
require("toggleterm").setup({ require("toggleterm").setup({
direction = 'float', direction = 'float',
open_mapping = [[<c-t>]] open_mapping = [[<c-t>]]
}) })
end end
} }
use { use {
'ggandor/leap.nvim', 'ggandor/leap.nvim',
config = function() config = function()
require('leap').add_default_mappings() require('leap').add_default_mappings()
end end
} }
use { use {
"folke/trouble.nvim", "folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons", requires = "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("trouble").setup() require("trouble").setup()
end end
} }
use { use {
'notjedi/nvim-rooter.lua', 'notjedi/nvim-rooter.lua',
config = function() config = function()
require'nvim-rooter'.setup() require 'nvim-rooter'.setup()
end end
} }
if packer_bootstrap then use({
require('packer').sync() "jackMort/ChatGPT.nvim",
end config = function()
require("chatgpt").setup()
end,
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
})
use({ 'sindrets/winshift.nvim',
config = function()
require("winshift").setup()
end
})
if packer_bootstrap then
require('packer').sync()
end
end) end)
local wk = require("which-key") local wk = require("which-key")
wk.register({ wk.register({
["<leader>"] = { ["<leader>"] = {
a = { ":Alpha<cr>", "Alpha" }, a = { ":Alpha<cr>", "Alpha" },
b = { b = {
name = "Buffer", name = "Buffer",
d = { ":bdelete!<cr>", "Delete" }, d = { ":bdelete!<cr>", "Delete" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" }, b = { "<cmd>Telescope buffers<cr>", "Buffers" },
t = { ":Neotree buffers<cr>", "Tree" }, t = { ":Neotree buffers<cr>", "Tree" },
}, },
c = "Comment", c = "Comment",
f = { f = {
name = "File", name = "File",
f = { "<cmd>Telescope find_files<cr>", "Files" }, f = { "<cmd>Telescope find_files<cr>", "Files" },
g = { "<cmd>Telescope live_grep<cr>", "Grep" }, g = { "<cmd>Telescope live_grep<cr>", "Grep" },
r = { "<cmd>Telescope oldfiles<cr>", "Recent" }, r = { "<cmd>Telescope oldfiles<cr>", "Recent" },
t = { ":Neotree<cr>", "Tree" }, t = { ":Neotree<cr>", "Tree" },
d = { ":cd %:p:h<cr>", "Set Directory" }, d = { ":cd %:p:h<cr>", "Set Directory" },
}, },
g = { g = {
name = "Git", name = "Git",
g = { ":2TermExec cmd='gitui'<cr>", "Gitui" }, g = { ":2TermExec cmd='gitui'<cr>", "Gitui" },
t = { ":Neotree git_status<cr>", "Tree" }, t = { ":Neotree git_status<cr>", "Tree" },
b = { ":Gitsigns blame_line<cr>", "Blame" }, b = { ":Gitsigns blame_line<cr>", "Blame" },
d = { ":DiffviewOpen<cr>", "Diff" }, d = { ":DiffviewOpen<cr>", "Diff" },
h = { ":DiffviewFileHistory<cr>", "History" }, h = { ":DiffviewFileHistory<cr>", "History" },
}, },
F = { ":lua vim.lsp.buf.format()<cr>", "Format" }, F = { ":lua vim.lsp.buf.format()<cr>", "Format" },
J = { ":SplitjoinJoin<cr>", "Join" }, J = { ":SplitjoinJoin<cr>", "Join" },
t = { t = {
name = "Table", name = "Table",
m = "Toggle Table Mode", m = "Toggle Table Mode",
t = "Tableize", t = "Tableize",
r = { ":TableModeRealign<cr>", "Realign" }, r = { ":TableModeRealign<cr>", "Realign" },
e = { ":TableEvalFormulaLine<cr>", "Evaluate" }, e = { ":TableEvalFormulaLine<cr>", "Evaluate" },
}, },
o = "Org", w = {
p = { name = "Window",
name = "Packer", s = { ":WinShift<cr>", "Shift" },
s = { ":PackerSync<cr>", "Sync" }, },
}, o = "Org",
S = { ":SplitjoinSplit<cr>", "Split" }, p = {
T = { ":TroubleToggle<cr>", "Trouble" }, name = "Packer",
}, s = { ":PackerSync<cr>", "Sync" },
["<S-l>"] = { ":BufferLineCycleNext<cr>", "Next Tab" }, },
["<S-h>"] = { ":BufferLineCyclePrev<cr>", "Previous Tab" }, S = { ":SplitjoinSplit<cr>", "Split" },
T = { ":TroubleToggle<cr>", "Trouble" },
},
["<S-l>"] = { ":BufferLineCycleNext<cr>", "Next Tab" },
["<S-h>"] = { ":BufferLineCyclePrev<cr>", "Previous Tab" },
}) })

Loading…
Cancel
Save