diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 64df71f..caa25a8 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -54,6 +54,25 @@ autocmd("CursorMoved", { 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 autocmd("BufReadPost", { pattern = "*", diff --git a/lua/lsp_settings.lua b/lua/lsp_settings.lua index d63a12b..b622d89 100644 --- a/lua/lsp_settings.lua +++ b/lua/lsp_settings.lua @@ -18,10 +18,6 @@ local on_attach = function(client, bufnr) vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] -- Enable completion triggered by 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. -- See `:help vim.lsp.*` for documentation on any of the below functions diff --git a/lua/plugins.lua b/lua/plugins.lua index 48d01a0..73d1c1d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,9 +1,16 @@ local vimp = require('vimp') return { - --vimp (in mappings.lua) + -- https://github.com/tpope/vim-obsession + 'tpope/vim-obsession', + + -- https://github.com/svermeulen/vimpeccable 'svermeulen/vimpeccable', + -- https://github.com/kien/ctrlp.vim + 'ctrlpvim/ctrlp.vim', + + -- https://github.com/nvim-treesitter/nvim-treesitter { 'nvim-treesitter/nvim-treesitter', config = function() @@ -13,8 +20,7 @@ return { end }, - 'ctrlpvim/ctrlp.vim', - + -- https://github.com/fatih/vim-go { 'fatih/vim-go', ft = { "go", "gomod" }, @@ -28,16 +34,7 @@ return { end }, - -- obsession - 'tpope/vim-obsession', - - --lsp (in lsp_settings.lua) - 'neovim/nvim-lspconfig', - 'williamboman/mason-lspconfig', - 'williamboman/mason.nvim', - 'mfussenegger/nvim-dap', - - -- auto color hex/rgb + -- https://github.com/norcalli/nvim-colorizer.lua { 'norcalli/nvim-colorizer.lua', config = function() @@ -45,6 +42,7 @@ return { end, }, + -- https://github.com/numToStr/Comment.nvim { 'numToStr/Comment.nvim', config = function() @@ -52,18 +50,8 @@ return { end }, - { - 'mrshmllow/document-color.nvim', - config = function() - require('document-color').setup({ - mode = "background", - }) - vim.g.colorizer_auto_color = 1 - end - }, - - -- Markdown preview + -- https://github.com/iamcco/markdown-preview.nvim { "iamcco/markdown-preview.nvim", run = "cd app && npm install", @@ -78,6 +66,7 @@ return { ft = { "markdown" } }, + -- https://github.com/ellisonleao/glow.nvim { "ellisonleao/glow.nvim", cmd = "Glow", @@ -86,7 +75,7 @@ return { end }, - -- auto pairs + -- https://github.com/windwp/nvim-autopairs { 'windwp/nvim-autopairs', config = function() @@ -94,7 +83,7 @@ return { end }, - -- show git diffs + -- https://github.com/lewis6991/gitsigns.nvim { 'lewis6991/gitsigns.nvim', config = function() @@ -113,20 +102,7 @@ return { end }, - - { - "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 + -- https://github.com/nvim-telescope/telescope.nvim { 'nvim-telescope/telescope.nvim', branch = '0.1.x', @@ -143,11 +119,13 @@ return { end }, - -- file explorer + -- https://github.com/nvim-tree/nvim-tree.lua { - 'kyazdani42/nvim-tree.lua', + 'nvim-tree/nvim-tree.lua', vimp.noremap({ 'silent' }, 'n', [[:NvimTreeToggle]]), - dependencies = { 'kyazdani42/nvim-web-devicons' }, + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, config = function() require('nvim-tree').setup { sort_by = "case_sensitive", @@ -167,10 +145,7 @@ return { end }, - - - { 'akinsho/toggleterm.nvim', version = "*", config = true }, - + -- https://github.com/kylechui/nvim-surround { "kylechui/nvim-surround", config = function() @@ -180,7 +155,7 @@ return { end }, - -- open file at last location + -- https://github.com/ethanholz/nvim-lastplace { 'ethanholz/nvim-lastplace', config = function() @@ -190,10 +165,10 @@ return { end }, - -- multiple cursors + -- https://github.com/mg979/vim-visual-multi 'mg979/vim-visual-multi', - -- wrap things inside pairs + -- https://github.com/FooSoft/vim-argwrap { 'FooSoft/vim-argwrap', config = function() @@ -201,32 +176,24 @@ return { end }, - -- pasting indents - { - 'hrsh7th/nvim-pasta', - config = function() - require('pasta').setup { - converters = { - require('pasta.converters').indentation, - }, - paste_mode = true, - next_key = vim.api.nvim_replace_termcodes('', true, true, true), - prev_key = vim.api.nvim_replace_termcodes('', true, true, true), - } - end - }, - - { 'akinsho/toggleterm.nvim', version = "*", config = true }, - + -- https://github.com/kylechui/nvim-surround { "kylechui/nvim-surround", config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) + require("nvim-surround").setup() 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", dependencies = { @@ -244,9 +211,8 @@ return { local cmp = require 'cmp' cmp.setup({ snippet = { - -- REQUIRED - you must specify a snippet engine expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + require('luasnip').lsp_expand(args.body) end, }, window = { @@ -258,7 +224,7 @@ return { [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -268,16 +234,14 @@ return { }) }) - -- Set configuration for specific filetype. cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. + { name = 'cmp_git' }, }, { { name = 'buffer' }, }) }) - -- buffer source for `/` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline('/', { mapping = cmp.mapping.preset.cmdline(), sources = { @@ -285,7 +249,6 @@ return { } }) - -- cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ @@ -297,26 +260,7 @@ return { end, }, - -- terminal toggler - { - "NvChad/nvterm", - config = function() - require("nvterm").setup() - local toggle_modes = { 'n', 't' } - local mappings = { - { toggle_modes, 'th', function() require("nvterm.terminal").toggle('horizontal') end }, - { toggle_modes, 'tv', function() require("nvterm.terminal").toggle('vertical') end }, - { toggle_modes, '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 + -- https://github.com/AlphaTechnolog/pywal.nvim { 'AlphaTechnolog/pywal.nvim', priority = 1000, @@ -327,10 +271,10 @@ return { end }, - -- better statusbar + -- https://github.com/nvim-lualine/lualine.nvim { 'hoob3rt/lualine.nvim', - dependencies = { { 'kyazdani42/nvim-web-devicons', lazy = true } }, + dependencies = { { 'nvim-tree/nvim-web-devicons' } }, config = function() require('lualine').setup({ options = { @@ -340,21 +284,31 @@ return { end, }, - -- better tabs + -- https://github.com/romgrk/barbar.nvim { - 'kdheepak/tabline.nvim', - dependencies = { { 'kyazdani42/nvim-web-devicons', lazy = true } }, + 'romgrk/barbar.nvim', + dependencies = 'nvim-tree/nvim-web-devicons', config = function() - vimp.nnoremap({ 'silent' }, '', [[:TablineBufferNext]]) - vimp.nnoremap({ 'silent' }, '', [[:TablineBufferPrevious]]) - require('tabline').setup({ options = { theme = 'pywal-nvim' } }) - end, + vimp.nnoremap({ 'silent' }, '', [[:BufferNext]]) + vimp.nnoremap({ 'silent' }, '', [[:BufferPrevious]]) + -- Set barbar's options + 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', - dependencies = { 'pywal' }, config = function() require('fwatch').watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors", { @@ -367,10 +321,10 @@ return { end, }, - -- greeter + -- https://github.com/goolord/alpha-nvim { 'goolord/alpha-nvim', - dependencies = { 'kyazdani42/nvim-web-devicons' }, + dependencies = { 'nvim-tree/nvim-web-devicons' }, config = function() local alpha = require('alpha') local dashboard = require('alpha.themes.dashboard')