This commit is contained in:
abs3nt 2023-03-02 23:35:22 -08:00
parent ed72d632ca
commit 850f7b03b1
3 changed files with 83 additions and 114 deletions

View File

@ -54,6 +54,25 @@ autocmd("CursorMoved", {
group = _group, group = _group,
}) })
local nvim_tree_events = require('nvim-tree.events')
local bufferline_api = require('bufferline.api')
local function get_tree_size()
return require 'nvim-tree.view'.View.width
end
nvim_tree_events.subscribe('TreeOpen', function()
bufferline_api.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe('Resize', function()
bufferline_api.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe('TreeClose', function()
bufferline_api.set_offset(0)
end)
-- change tmux title -- change tmux title
autocmd("BufReadPost", { autocmd("BufReadPost", {
pattern = "*", pattern = "*",

View File

@ -18,10 +18,6 @@ local on_attach = function(client, bufnr)
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
if client.server_capabilities.colorProvider then
-- Attach document colour support
require("document-color").buf_attach(bufnr, { mode = "background" })
end
-- Mappings. -- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions

View File

@ -1,9 +1,16 @@
local vimp = require('vimp') local vimp = require('vimp')
return { return {
--vimp (in mappings.lua) -- https://github.com/tpope/vim-obsession
'tpope/vim-obsession',
-- https://github.com/svermeulen/vimpeccable
'svermeulen/vimpeccable', 'svermeulen/vimpeccable',
-- https://github.com/kien/ctrlp.vim
'ctrlpvim/ctrlp.vim',
-- https://github.com/nvim-treesitter/nvim-treesitter
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
config = function() config = function()
@ -13,8 +20,7 @@ return {
end end
}, },
'ctrlpvim/ctrlp.vim', -- https://github.com/fatih/vim-go
{ {
'fatih/vim-go', 'fatih/vim-go',
ft = { "go", "gomod" }, ft = { "go", "gomod" },
@ -28,16 +34,7 @@ return {
end end
}, },
-- obsession -- https://github.com/norcalli/nvim-colorizer.lua
'tpope/vim-obsession',
--lsp (in lsp_settings.lua)
'neovim/nvim-lspconfig',
'williamboman/mason-lspconfig',
'williamboman/mason.nvim',
'mfussenegger/nvim-dap',
-- auto color hex/rgb
{ {
'norcalli/nvim-colorizer.lua', 'norcalli/nvim-colorizer.lua',
config = function() config = function()
@ -45,6 +42,7 @@ return {
end, end,
}, },
-- https://github.com/numToStr/Comment.nvim
{ {
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function() config = function()
@ -52,18 +50,8 @@ return {
end end
}, },
{
'mrshmllow/document-color.nvim',
config = function()
require('document-color').setup({
mode = "background",
})
vim.g.colorizer_auto_color = 1
end
},
-- https://github.com/iamcco/markdown-preview.nvim
-- Markdown preview
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
run = "cd app && npm install", run = "cd app && npm install",
@ -78,6 +66,7 @@ return {
ft = { "markdown" } ft = { "markdown" }
}, },
-- https://github.com/ellisonleao/glow.nvim
{ {
"ellisonleao/glow.nvim", "ellisonleao/glow.nvim",
cmd = "Glow", cmd = "Glow",
@ -86,7 +75,7 @@ return {
end end
}, },
-- auto pairs -- https://github.com/windwp/nvim-autopairs
{ {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
config = function() config = function()
@ -94,7 +83,7 @@ return {
end end
}, },
-- show git diffs -- https://github.com/lewis6991/gitsigns.nvim
{ {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = function() config = function()
@ -113,20 +102,7 @@ return {
end end
}, },
-- https://github.com/nvim-telescope/telescope.nvim
{
"folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
require("todo-comments").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
},
-- fuzzy finder
{ {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
branch = '0.1.x', branch = '0.1.x',
@ -143,11 +119,13 @@ return {
end end
}, },
-- file explorer -- https://github.com/nvim-tree/nvim-tree.lua
{ {
'kyazdani42/nvim-tree.lua', 'nvim-tree/nvim-tree.lua',
vimp.noremap({ 'silent' }, '<leader>n', [[:NvimTreeToggle<CR>]]), vimp.noremap({ 'silent' }, '<leader>n', [[:NvimTreeToggle<CR>]]),
dependencies = { 'kyazdani42/nvim-web-devicons' }, dependencies = {
'nvim-tree/nvim-web-devicons'
},
config = function() config = function()
require('nvim-tree').setup { require('nvim-tree').setup {
sort_by = "case_sensitive", sort_by = "case_sensitive",
@ -167,10 +145,7 @@ return {
end end
}, },
-- https://github.com/kylechui/nvim-surround
{ 'akinsho/toggleterm.nvim', version = "*", config = true },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
config = function() config = function()
@ -180,7 +155,7 @@ return {
end end
}, },
-- open file at last location -- https://github.com/ethanholz/nvim-lastplace
{ {
'ethanholz/nvim-lastplace', 'ethanholz/nvim-lastplace',
config = function() config = function()
@ -190,10 +165,10 @@ return {
end end
}, },
-- multiple cursors -- https://github.com/mg979/vim-visual-multi
'mg979/vim-visual-multi', 'mg979/vim-visual-multi',
-- wrap things inside pairs -- https://github.com/FooSoft/vim-argwrap
{ {
'FooSoft/vim-argwrap', 'FooSoft/vim-argwrap',
config = function() config = function()
@ -201,32 +176,24 @@ return {
end end
}, },
-- pasting indents -- https://github.com/kylechui/nvim-surround
{
'hrsh7th/nvim-pasta',
config = function()
require('pasta').setup {
converters = {
require('pasta.converters').indentation,
},
paste_mode = true,
next_key = vim.api.nvim_replace_termcodes('<C-p>', true, true, true),
prev_key = vim.api.nvim_replace_termcodes('<C-n>', true, true, true),
}
end
},
{ 'akinsho/toggleterm.nvim', version = "*", config = true },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
config = function() config = function()
require("nvim-surround").setup({ require("nvim-surround").setup()
-- Configuration here, or leave empty to use defaults
})
end end
}, },
-- https://github.com/neovim/nvim-lspconfig
'neovim/nvim-lspconfig',
-- https://github.com/williamboman/mason-lspconfig.nvim
'williamboman/mason-lspconfig',
-- https://github.com/williamboman/mason.nvim
'williamboman/mason.nvim',
-- https://github.com/hrsh7th/nvim-cmp
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { dependencies = {
@ -244,9 +211,8 @@ return {
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.setup({ cmp.setup({
snippet = { snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args) expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users. require('luasnip').lsp_expand(args.body)
end, end,
}, },
window = { window = {
@ -258,7 +224,7 @@ return {
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ['<CR>'] = cmp.mapping.confirm({ select = false }),
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
@ -268,16 +234,14 @@ return {
}) })
}) })
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', { cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. { name = 'cmp_git' },
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
}) })
}) })
-- buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
@ -285,7 +249,6 @@ return {
} }
}) })
-- cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
@ -297,26 +260,7 @@ return {
end, end,
}, },
-- terminal toggler -- https://github.com/AlphaTechnolog/pywal.nvim
{
"NvChad/nvterm",
config = function()
require("nvterm").setup()
local toggle_modes = { 'n', 't' }
local mappings = {
{ toggle_modes, '<leader>th', function() require("nvterm.terminal").toggle('horizontal') end },
{ toggle_modes, '<leader>tv', function() require("nvterm.terminal").toggle('vertical') end },
{ toggle_modes, '<leader>tf', function() require("nvterm.terminal").toggle('float') end },
}
local opts = { noremap = true, silent = true }
for _, mapping in ipairs(mappings) do
vim.keymap.set(mapping[1], mapping[2], mapping[3], opts)
end
end
},
--- THEME STUFF
-- colors
{ {
'AlphaTechnolog/pywal.nvim', 'AlphaTechnolog/pywal.nvim',
priority = 1000, priority = 1000,
@ -327,10 +271,10 @@ return {
end end
}, },
-- better statusbar -- https://github.com/nvim-lualine/lualine.nvim
{ {
'hoob3rt/lualine.nvim', 'hoob3rt/lualine.nvim',
dependencies = { { 'kyazdani42/nvim-web-devicons', lazy = true } }, dependencies = { { 'nvim-tree/nvim-web-devicons' } },
config = function() config = function()
require('lualine').setup({ require('lualine').setup({
options = { options = {
@ -340,21 +284,31 @@ return {
end, end,
}, },
-- better tabs -- https://github.com/romgrk/barbar.nvim
{ {
'kdheepak/tabline.nvim', 'romgrk/barbar.nvim',
dependencies = { { 'kyazdani42/nvim-web-devicons', lazy = true } }, dependencies = 'nvim-tree/nvim-web-devicons',
config = function() config = function()
vimp.nnoremap({ 'silent' }, '<A-Right>', [[:TablineBufferNext<CR>]]) vimp.nnoremap({ 'silent' }, '<A-Right>', [[:BufferNext<CR>]])
vimp.nnoremap({ 'silent' }, '<A-Left>', [[:TablineBufferPrevious<CR>]]) vimp.nnoremap({ 'silent' }, '<A-Left>', [[:BufferPrevious<CR>]])
require('tabline').setup({ options = { theme = 'pywal-nvim' } }) -- Set barbar's options
end, require 'bufferline'.setup {
animation = true,
closable = true,
clickable = true,
-- Configure icons on the bufferline.
icon_separator_active = ' ',
icon_separator_inactive = ' ',
icon_close_tab = '',
icon_close_tab_modified = '',
icon_pinned = '',
}
end
}, },
-- fwatch updates colors automatically -- https://github.com/rktjmp/fwatch.nvim
{ {
'rktjmp/fwatch.nvim', 'rktjmp/fwatch.nvim',
dependencies = { 'pywal' },
config = function() config = function()
require('fwatch').watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors", require('fwatch').watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors",
{ {
@ -367,10 +321,10 @@ return {
end, end,
}, },
-- greeter -- https://github.com/goolord/alpha-nvim
{ {
'goolord/alpha-nvim', 'goolord/alpha-nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' }, dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function() config = function()
local alpha = require('alpha') local alpha = require('alpha')
local dashboard = require('alpha.themes.dashboard') local dashboard = require('alpha.themes.dashboard')