chore: Massive restructure. FIXED TAB BUG . Packer -> Lazy . barbar -> bufferline .

This commit is contained in:
Afonso Franco 2023-01-14 04:05:17 +00:00
parent b2267a0e47
commit 5e1cd7267d
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
15 changed files with 275 additions and 500 deletions

View file

@ -0,0 +1,17 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
--Call lazy config here
require('plugins.lazy')

View file

@ -0,0 +1,29 @@
--Leader
vim.g.mapleader = " "
--termguicolors
vim.opt.termguicolors = true
--Relative line numbers
vim.wo.number=true
vim.wo.relativenumber= true
--Remove search highlight
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.smartindent = true
--Move lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
--Remove Wrap
vim.opt.wrap = false
--Not let cursor go bellow 10 chars.
vim.opt.scrolloff = 10
--4 space indent
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
--quickfix keybinds
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
--Undo dir
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true

View file

@ -1,64 +0,0 @@
--Leader
vim.g.mapleader = " "
--Relative line numbers
vim.wo.number=true
vim.wo.relativenumber= true
--Remove search highlight
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.smartindent = true
--Move lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
--Remove Wrap
vim.opt.wrap = false
--Not let cursor go bellow 10 chars.
vim.opt.scrolloff = 10
--4 space indent
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
--quickfix keybinds
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
--Undo dir
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
--TAB KEYBINDINGS
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
-- Re-order to previous/next
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
-- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
-- Pin/unpin buffer
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
-- Magic buffer-picking mode
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
-- Sort automatically by...
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
--NVimTree
map('n', '<C-n>', '<Cmd>NvimTreeToggle<CR>',opts)

View file

@ -1,74 +0,0 @@
-- Set barbar's options
require'bufferline'.setup {
-- Enable/disable animations
animation = true,
-- Enable/disable auto-hiding the tab bar when there is a single buffer
auto_hide = false,
-- Enable/disable current/total tabpages indicator (top right corner)
tabpages = true,
-- Enable/disable close button
closable = true,
-- Enables/disable clickable tabs
-- - left-click: go to buffer
-- - middle-click: delete buffer
clickable = true,
-- Excludes buffers from the tabline
exclude_ft = {'javascript'},
exclude_name = {'package.json'},
-- Show every buffer
hide = {current = false, inactive = false, visible = false},
-- Enable/disable icons
-- if set to 'numbers', will show buffer index in the tabline
-- if set to 'both', will show buffer index and icons in the tabline
icons = true,
-- If set, the icon color will follow its corresponding buffer
-- highlight group. By default, the Buffer*Icon group is linked to the
-- Buffer* group (see Highlighting below). Otherwise, it will take its
-- default value as defined by devicons.
icon_custom_colors = false,
-- Configure icons on the bufferline.
icon_separator_active = '',
icon_separator_inactive = '',
icon_close_tab = '',
icon_close_tab_modified = '',
icon_pinned = '',
-- If true, new buffers will be inserted at the start/end of the list.
-- Default is to insert after current buffer.
insert_at_end = false,
insert_at_start = false,
-- Sets the maximum padding width with which to surround each tab
maximum_padding = 1,
-- Sets the minimum padding width with which to surround each tab
minimum_padding = 1,
-- Sets the maximum buffer name length.
maximum_length = 30,
-- If set, the letters for each buffer in buffer-pick mode will be
-- assigned based on their name. Otherwise or in case all letters are
-- already assigned, the behavior is to assign letters in order of
-- usability (see order below)
semantic_letters = true,
-- New buffer letters are assigned in this order. This order is
-- optimal for the qwerty keyboard layout but might need adjustement
-- for other layouts.
letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
-- where X is the buffer number. But only a static string is accepted here.
no_name_title = nil,
}

View file

@ -0,0 +1,70 @@
--KEYBINDINGS
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<A-,>', '<Cmd>BufferLineCyclePrev<CR>', opts)
map('n', '<A-.>', '<Cmd>BufferLineCycleNext<CR>', opts)
-- Re-order to previous/next
map('n', '<A-<>', '<Cmd>BufferLineMovePrevious<CR>', opts)
map('n', '<A->>', '<Cmd>BufferLineMoveNext<CR>', opts)
-- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferLineGoToBuffer 1<CR>', opts)
map('n', '<A-2>', '<Cmd>BufferLineGoToBuffer 2<CR>', opts)
map('n', '<A-3>', '<Cmd>BufferLineGoToBuffer 3<CR>', opts)
map('n', '<A-4>', '<Cmd>BufferLineGoToBuffer 4<CR>', opts)
map('n', '<A-5>', '<Cmd>BufferLineGoToBuffer 5<CR>', opts)
map('n', '<A-6>', '<Cmd>BufferLineGoToBuffer 6<CR>', opts)
map('n', '<A-7>', '<Cmd>BufferLineGoToBuffer 7<CR>', opts)
map('n', '<A-8>', '<Cmd>BufferLineGoToBuffer 8<CR>', opts)
map('n', '<A-9>', '<Cmd>BufferLineGoToBuffer 9<CR>', opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferLinePickClose<CR>', opts)
-- Set bufferline's options
require("bufferline").setup({
options = {
mode = "buffers",
numbers = "none",
close_command = "bdelete! %d",
right_mouse_command = "bdelete! %d",
left_mouse_command = "buffer %d",
middle_mouse_command = "bdelete! %d",
indicator = {
icon = "",
style = "icon",
},
buffer_close_icon = '',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 18,
max_prefix_length = 15,
truncate_names = true,
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = true,
diagnostics_indicator = function(count, level, diagnostics_dict, context)
return "(" .. count .. ")"
end,
color_icons = true,
show_buffer_icons = true,
show_buffer_close_icons = true,
show_buffer_default_icon = true,
show_close_icon = true,
show_tab_indicators = true,
show_duplicate_prefix = true,
persist_buffer_sort = true,
separator_style = "slant",
enforce_regular_tabs = true,
always_show_bufferline = true,
hover = {
enabled = true,
delay = 200,
reveal = { 'close' }
},
sort_by = 'insert_after_current',
},
highlights = require("catppuccin.groups.integrations.bufferline").get()
})

View file

@ -62,18 +62,11 @@ cmp.setup {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = true },
-- Accept currently selected item. If none selected, do nothing.
["<CR>"] = cmp.mapping.confirm { select = false },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
@ -84,8 +77,6 @@ cmp.setup {
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
@ -125,7 +116,7 @@ cmp.setup {
local kind = entry:get_kind()
local line = context.cursor_line
local col = context.cursor.col
local char_before_cursor = string.sub(line, col - 1, col)
local char_before_cursor = string.sub(line, col - 1, col - 1)
if char_before_cursor == "." then
@ -144,7 +135,7 @@ cmp.setup {
},
{ name = 'nvim_lua' },
{ name = 'luasnip'},
{ name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' },
{ name = "path" },
},

View file

@ -1,6 +0,0 @@
vim.g.coq_settings = {
auto_start = 'shut-up',
clients = {
tmux = { enabled = false },
},
}

View file

@ -0,0 +1,141 @@
local lazy = require('lazy')
lazy.setup({
'lewis6991/impatient.nvim',
-------------------------------------------THEMES------------------------------------------
'joshdick/onedark.vim',
{ 'catppuccin/nvim',
lazy = false,
priority = 1000,
config = function ()
require('plugins.catppuccin')
end
},
-------------------------------------------------------QOL---------------------------------
--better navigation with 's-letter'
{ 'ggandor/leap.nvim',
config = function()
require('leap').add_default_mappings()
end
},
--Change add and remove surroundings from words
'tpope/vim-surround',
-- Rename variable pop up
'stevearc/dressing.nvim',
{ 'windwp/nvim-autopairs',
config = function() require('nvim-autopairs').setup {}
end
},
'nvim-tree/nvim-web-devicons',
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
config = function()
require 'plugins.lualine'
end
},
-------------------------------------------------------LSP----------------------------------------------
{ 'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-nvim-lsp', -- lsp
'hrsh7th/cmp-nvim-lua', -- Nvim API completions
'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures
'hrsh7th/cmp-buffer', --buffer completions
'hrsh7th/cmp-path', --path completions
'hrsh7th/cmp-cmdline', --cmdline completions
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
},
config = function()
require 'plugins.cmp'
end
},
--LSP Status
{ 'j-hui/fidget.nvim',
config = function()
require('fidget').setup {}
end
},
{ 'williamboman/mason.nvim',
config = function()
require 'plugins.mason'
end
},
'williamboman/mason-lspconfig.nvim',
{ 'neovim/nvim-lspconfig',
config = function()
require 'plugins.lspconfig'
end
},
{ 'jose-elias-alvarez/null-ls.nvim',
config = function()
require 'plugins.null-ls'
end
},
{ 'lervag/vimtex',
config = function()
require 'plugins.vimtex'
end
},
-------------------------------------------------------------------------------------------
-- Syntax Highlighting
{ 'nvim-treesitter/nvim-treesitter',
config = function()
require 'plugins.treesitter'
end
},
--Sticky headers
{ 'nvim-treesitter/nvim-treesitter-context',
config = function()
require 'plugins.treesitter-context'
end
},
--Tabs
{ 'akinsho/bufferline.nvim',
version = 'v3.*',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function()
require("plugins.bufferline")
end
},
--{ 'romgrk/barbar.nvim',
-- dependencies = 'nvim-tree/nvim-web-devicons',
-- config = function()
-- require 'plugins.barbar'
-- end
--},
--does so much
{
'nvim-telescope/telescope.nvim', tag = '0.1.0',
-- or , branch = '0.1.x',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function() require('plugins.telescope') end
},
--Main menu
{ 'startup-nvim/startup.nvim',
dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' },
config = function()
require('startup').setup { theme = 'dashboard' }
end,
},
})

View file

@ -21,7 +21,7 @@ require('lualine').setup {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_x = {'lsp', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},

View file

@ -1,162 +0,0 @@
local packer = require("packer")
local plugins = packer.startup({ function(use)
use {
"wbthomason/packer.nvim",
config = [[require("plugins.packer")]]
}
use { "lewis6991/impatient.nvim" }
use { "lervag/vimtex",
config = function()
require "plugins.vimtex"
end
}
-------------------------------------------------------QOL----------------------------------------------
use { "ggandor/leap.nvim",
config = function()
require('leap').add_default_mappings()
end
}
use { "stevearc/dressing.nvim" } -- Rename variable pop up
use { "windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {}
end
}
use { "kyazdani42/nvim-web-devicons" }
use {
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require 'plugins.lualine'
end
}
use {"j-hui/fidget.nvim",
config = function ()
require("fidget").setup{}
end
}
use {"voldikss/vim-floaterm"}
--------------------------------------------------SUGGESTION BOX-----------------------------------------
use { "hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-nvim-lsp", -- lsp
"hrsh7th/cmp-nvim-lua", -- Nvim API completions
"hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures
"hrsh7th/cmp-buffer", --buffer completions
"hrsh7th/cmp-path", --path completions
"hrsh7th/cmp-cmdline" --cmdline completions
},
config = function()
require "plugins.cmp"
end
}
use { "L3MON4D3/LuaSnip",
requires = {
"saadparwaiz1/cmp_luasnip"
},
}
-------------------------------------------------------LSP----------------------------------------------
use { "williamboman/mason.nvim",
config = function()
require "plugins.mason"
end
}
use { "williamboman/mason-lspconfig.nvim" }
use { "neovim/nvim-lspconfig",
config = function()
require "plugins.lspconfig"
end
}
use { "jose-elias-alvarez/null-ls.nvim",
config = function()
require "plugins.null-ls"
end
}
------------------------------------------------------------------------------------------
use { "nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons", -- optional, for file icons
},
config = function()
require("nvim-tree").setup()
end
}
use { "feline-nvim/feline.nvim" }
-------------------------------------------THEMES------------------------------------------
use { "joshdick/onedark.vim" }
use { "catppuccin/nvim" }
-------------------------------------------------------------------------------------------
use { "nvim-treesitter/nvim-treesitter",
config = function()
require "plugins.treesitter"
end
}
use { "nvim-treesitter/nvim-treesitter-context",
config = function()
require "plugins.treesitter-context"
end
}
--Tabs
use { "romgrk/barbar.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require "plugins.barbar"
end
}
--fuzzy file finding
use {
"nvim-telescope/telescope.nvim", tag = '0.1.0',
-- or , branch = '0.1.x',
requires = { { "nvim-lua/plenary.nvim" } },
config = function() require('plugins.telescope') end
}
use { "tpope/vim-surround" }
use { "startup-nvim/startup.nvim",
requires = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
config = function()
require("startup").setup { theme = "dashboard" }
end,
}
end,
config = {
auto_clean = true,
compile_on_sync = true,
git = { clone_timeout = 6000 },
display = {
working_sym = "",
error_sym = "",
done_sym = "",
removed_sym = "",
moved_sym = "",
},
}
})

View file

@ -4,20 +4,21 @@ require('nvim-treesitter.install').update({ with_sync = true })
if not present then
return
return
end
local options = {
ensure_installed = {"lua", "haskell", "rust", },
ensure_installed = { "lua", "haskell", "rust", "markdown", "markdown_inline" },
highlight = {
enable = true,
use_languagetree = true,
},
highlight = {
enable = true,
use_languagetree = true,
additional_vim_regex_highlighting = { "markdown" },
},
indent = {
enable = true,
},
indent = {
enable = true,
},
}
treesitter.setup(options)