Use lazy.nvim

This commit is contained in:
Saeed Afzal
2023-04-29 12:34:36 +01:00
parent 17ab6018fb
commit 86cc9b52ec
28 changed files with 308 additions and 493 deletions

11
lua/plugins/barbar.lua Normal file
View File

@@ -0,0 +1,11 @@
return {
"romgrk/barbar.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
init = function() vim.g.barbar_auto_setup = false end,
opts = {
auto_hide = true,
sidebar_filetypes = {
["neo-tree"] = { event = "BufWipeout" }
}
}
}

View File

@@ -1,18 +0,0 @@
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)

43
lua/plugins/blankline.lua Normal file
View File

@@ -0,0 +1,43 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = "BufEnter",
opts = {
char = "",
context_char = "",
filetype_exclude = {
"help",
"terminal",
"alpha",
"lazy",
"neo-tree",
"Trouble"
},
buftype_exclude = { "nofile", "terminal" },
context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type"
},
show_trailing_blankline_indent = false,
show_first_indent_level = false,
use_treesitter = true,
show_current_context = true
}
}

19
lua/plugins/colorizer.lua Normal file
View File

@@ -0,0 +1,19 @@
return {
"NvChad/nvim-colorizer.lua",
event = "BufEnter",
opts = {
filetypes = {
"*";
"!markdown";
},
user_default_options = {
RRGGBBAA = true,
AARRGGBB = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
sass = { enable = true }
}
}
}

View File

@@ -1,8 +0,0 @@
require("indent_blankline").setup {
indentLine_enabled = 1,
char = "",
filetype_exclude = {"help", "terminal", "alpha"},
buftype_exclude = {"terminal"},
show_trailing_blankline_indent = false,
show_first_indent_level = false
}

View File

@@ -1,26 +0,0 @@
local cmp = require("cmp")
cmp.setup {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item()
}),
sources = cmp.config.sources({
{ name = "nvim-lsp" },
{ name = "luasnip" }
}, {
{ name = "buffer" }
})
}

View File

@@ -1,11 +0,0 @@
require("colorizer").setup {
user_default_options = {
RRGGBBAA = true,
AARRGGBB = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
sass = { enable = true }
}
}

View File

@@ -1,3 +0,0 @@
require("illuminate").configure {
}

View File

@@ -1,14 +0,0 @@
require("lualine").setup {
options = {
theme = "tokyonight"
},
extensions = {
"fzf",
"nvim-dap-ui",
"nvim-tree",
"quickfix",
"symbols-outline",
"toggleterm"
}
}

View File

@@ -1,10 +0,0 @@
local mason = require("mason-lspconfig")
local lsp = require("lspconfig")
mason.setup{}
mason.setup_handlers {
function (server_name)
lsp[server_name].setup{}
end
}

View File

@@ -1,28 +0,0 @@
require("nvim-tree").setup {
view = {
hide_root_folder = true
},
renderer = {
group_empty = true,
highlight_git = true,
indent_markers = {
enable = true
}
},
update_focused_file = {
enable = true,
update_root = true
},
diagnostics = {
enable = true,
show_on_dirs = true
},
filters = {
custom = { ".git" }
}
}

View File

@@ -1,7 +0,0 @@
local telescope = require("telescope")
telescope.setup {
file_ignore_patterns = { "node_modules" }
}
telescope.load_extension("fzf")

View File

@@ -1,15 +0,0 @@
require("toggleterm").setup {
size = function(term)
if term.direction == "horizontal" then
return 25
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-t>]],
direction = "float",
float_opts = {
border = "curved"
}
}

View File

@@ -1,12 +0,0 @@
require("tokyonight").setup {
style = "night",
styles = {
comments = { italic = true },
keywords = { italic = true, bold = true },
functions = { italic = true, bold = true },
variables = { italic = true, bold = true }
},
lualine_bold = true
}
vim.cmd [[colorscheme tokyonight]]

View File

@@ -1,9 +0,0 @@
require("nvim-treesitter.configs").setup {
ensure_installed = { "vim", "lua", "typescript" },
auto_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false
}
}

View File

@@ -1,82 +0,0 @@
local wk = require("which-key")
wk.setup {
ignore_missing = true,
key_labels = {
["<space>"] = "SPC"
}
}
wk.register({
["<leader>"] = {
f = {
name = "Find",
f = { "<cmd>Telescope fd<CR>", "find file" },
w = { "<cmd>Telescope live_grep<CR>", "live grep" },
s = { "<cmd>Telescope spell_suggest<CR>", "spell suggest" },
b = { "<cmd>Telescope buffers<CR>", "all buffers" },
t = { "<cmd>TodoTelescope<CR>", "todos" },
["."] = { "<cmd>Telescope keymaps<CR>", "keymaps" }
},
l = {
name = "LSP",
r = { "<cmd>lua require('cosmic-ui').rename()<CR>", "rename" },
d = { "<cmd>Telescope diagnostics<CR>", "diagnostics" },
f = { "<cmd>lua vim.lsp.buf.format { async = true }<CR>", "format" },
a = { "<cmd>CodeActionMenu<CR>", "code action" }
},
b = {
name = "Buffer",
p = { "<cmd>BufferPick<CR>", "pick buffer" },
q = { "<cmd>BufferMovePrevious<CR>", "move buffer left" },
w = { "<cmd>BufferMoveNext<CR>", "move buffer right" },
x = { "<cmd>BufferCloseAllButCurrent<CR>", "close all but current" }
},
g = {
name = "Git",
b = { "<cmd>Gitsigns blame_line<CR>", "blame line" },
d = { "<cmd>Gitsigns diffthis<CR>", "diff" },
s = { "<cmd>Telescope git_status<CR>", "git status" },
c = { "<cmd>Telescope git_commits<CR>", "commits" }
},
x = { "<cmd>BufferClose<CR>", "close buffer" },
r = { "<cmd>NvimTreeRefresh<CR>", "refresh tree" },
c = { "<cmd>Telescope colorscheme<CR>", "colorscheme" },
s = { "<cmd>SymbolsOutline<CR>", "symbols outline" },
h = { "<cmd>noh<CR>", "no highlight" },
t = {
name = "Terminal",
t = { "<cmd>ToggleTerm direction=horizontal<CR>", "open terminal" }
}
},
t = {
name = "Trouble",
t = { "<cmd>TroubleToggle<CR>", "toggle trouble" }
},
g = {
d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "definition" },
D = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "declaration" },
i = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "implementation" },
t = { "<cmd>lua vim.lsp.buf.type_definition()<CR>", "type definition" }
},
K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "hover" },
["<C-k>"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "signature help" },
-- Nvim Tree
["<C-n>"] = { "<cmd>NvimTreeToggle .<CR>", "toggle nvimtree" },
-- Switching Buffers
["<TAB>"] = { "<cmd>BufferNext<CR>", "next buffer" },
["<S-TAB>"] = { "<cmd>BufferPrevious<CR>", "previous buffer" },
-- Find in file
["<C-f>"] = { "<cmd>Telescope current_buffer_fuzzy_find<CR>", "find in file" }
})

View File

@@ -1,2 +1,55 @@
require("plugins.setup")
require("plugins.barbar_nvimtree")
return {
"nvim-lua/plenary.nvim",
"nathom/filetype.nvim",
"LunarVim/bigfile.nvim",
"f-person/git-blame.nvim",
{
"numToStr/Comment.nvim",
event = "BufEnter",
config = true
},
{
"goolord/alpha-nvim",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
require("alpha").setup(require("alpha.themes.dashboard").config)
end
},
{
"andymass/vim-matchup",
dependencies = "nvim-treesitter/nvim-treesitter",
event = "BufEnter"
},
{
"ellisonleao/glow.nvim",
cmd = "Glow",
config = true
},
{
"folke/todo-comments.nvim",
dependencies = "nvim-lua/plenary.nvim",
config = true
},
{
"nmac427/guess-indent.nvim",
config = true
},
{
"lewis6991/gitsigns.nvim",
config = true
},
{
"sindrets/diffview.nvim",
dependencies = "nvim-lua/plenary.nvim",
cmd = "DiffviewOpen",
config = true
}
}

19
lua/plugins/lualine.lua Normal file
View File

@@ -0,0 +1,19 @@
return {
"nvim-lualine/lualine.nvim",
event = "BufEnter",
opts = {
options = {
theme = "tokyonight"
},
extensions = {
"fzf",
"lazy",
"neo-tree",
"nvim-dap-ui",
"symbols-outline",
"toggleterm",
"trouble"
}
}
}

33
lua/plugins/neotree.lua Normal file
View File

@@ -0,0 +1,33 @@
return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim"
},
cmd = "Neotree",
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
opts = {
close_if_last_window = true,
source_selector = {
winbar = true,
content_layout = "center",
sources = {
{ source = "filesystem" },
{ source = "buffers" },
{ source = "git_status" },
{ source = "diagnostics" }
}
},
group_empty_dirs = true,
window = { width = 30 },
filesystem = {
follow_current_file = true,
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true
}
}
}

View File

@@ -1,242 +0,0 @@
-- Install packer for the first time
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- Safely load packer
local ok, packer = pcall(require, "packer")
if not ok then
return
end
-- Setup the plugins
return packer.startup(function(use)
use "wbthomason/packer.nvim"
use "nvim-lua/plenary.nvim"
use "nathom/filetype.nvim"
use {
"folke/tokyonight.nvim",
config = function()
require("plugins.config.tokyonight")
end
}
use "kyazdani42/nvim-web-devicons"
use {
"kyazdani42/nvim-tree.lua",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("plugins.config.nvimtree")
end
}
use {
"romgrk/barbar.nvim",
requires = "kyazdani42/nvim-web-devicons"
}
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("plugins.config.treesitter")
end
}
use {
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require("plugins.config.lualine")
end
}
use {
"NvChad/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end
}
use {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end
}
use {
"lukas-reineke/indent-blankline.nvim",
config = function()
require("plugins.config.blankline")
end
}
use {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end
}
use {
"akinsho/toggleterm.nvim",
tag = "*",
config = function()
require("plugins.config.toggleterm")
end
}
use {
"goolord/alpha-nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("alpha").setup(require("alpha.themes.dashboard").config)
end
}
-- Teleport
use {
"nvim-telescope/telescope-fzf-native.nvim",
run = "make"
}
use {
"nvim-telescope/telescope.nvim",
tag = "0.1.1",
requires = "nvim-lua/plenary.nvim",
config = function()
require("plugins.config.telescope")
end
}
-- LSP
use {
"williamboman/mason.nvim",
requires = "neovim/nvim-lspconfig",
config = function()
require("mason").setup()
end
}
use {
"williamboman/mason-lspconfig.nvim",
requires = {
"neovim/nvim-lspconfig",
"williamboman/mason.nvim"
},
config = function()
require("plugins.config.mason")
end
}
use {
"hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
},
config = function()
require("plugins.config.cmp")
end
}
use {
"rafamadriz/friendly-snippets",
requires = "L3MON4D3/LuaSnip"
}
use {
"ray-x/lsp_signature.nvim",
after = "nvim-lspconfig",
config = function()
require("lsp_signature").setup()
end
}
use {
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end
}
use {
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup()
end
}
use {
"folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
require("todo-comments").setup()
end
}
use {
"simrat39/symbols-outline.nvim",
config = function()
require("symbols-outline").setup()
end
}
use {
"folke/which-key.nvim",
config = function()
require("plugins.config.whichkey")
end
}
use {
"RRethy/vim-illuminate",
requires = "neovim/nvim-lspconfig"
}
use {
"weilbith/nvim-code-action-menu",
requires = "neovim/nvim-lspconfig",
cmd = "CodeActionMenu"
}
use {
"ellisonleao/glow.nvim",
config = function()
require("glow").setup()
end
}
use {
"CosmicNvim/cosmic-ui",
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim"
},
config = function()
require("cosmic-ui").setup()
end
}
if packer_bootstrap then
require("packer").sync()
end
end)

View File

@@ -0,0 +1,7 @@
return {
"mrjones2014/smart-splits.nvim",
build = "./kitty/install-kittens.bash",
opt = {
ignored_buftypes = { "NeoTree" }
}
}

20
lua/plugins/telescope.lua Normal file
View File

@@ -0,0 +1,20 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
enabled = vim.fn.executable "make" == 1,
build = "make"
},
cmd = "Telescope",
opts = {
defaults = {
layout_strategy = "vertical"
},
file_ignore_patterns = { "node_modules" }
},
config = function()
local telescope = require("telescope")
telescope.load_extension("fzf")
end
}

View File

@@ -0,0 +1,20 @@
return {
"akinsho/toggleterm.nvim",
version = "*",
keys = { "<C-t>" },
opts = {
size = function(term)
if term.direction == "horizontal" then
return 25
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-t>]],
direction = "float",
float_opts = {
border = "curved"
}
}
}

View File

@@ -0,0 +1,13 @@
return {
"folke/tokyonight.nvim",
opts = {
style = "night",
styles = {
comments = { italic = true },
keywords = { italic = true, bold = true },
functions = { italic = true, bold = true },
variables = { bold = true }
},
lualine_bold = true
}
}

View File

@@ -0,0 +1,15 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup {
highlight = { enable = true },
incremental_selection = { enable = true },
indent = { enable = true },
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
matchup = { enable = true }
}
end
}