Simplify config

This commit is contained in:
Saeed Afzal
2023-12-21 23:10:23 +00:00
parent 862d8bb1ec
commit 7d7b0fff77
17 changed files with 101 additions and 253 deletions

View File

@@ -1,10 +1,11 @@
local opt = vim.opt
local g = vim.g
local api = vim.api
local opt, g, api =
vim.opt,
vim.g,
vim.api
-- Disable netrw
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
-- g.loaded_netrw = 1
-- g.loaded_netrwPlugin = 1
-- Settings
g.mapleader = " "
@@ -30,7 +31,6 @@ local function indent(n, expand)
local size = 4
if n ~= "" then size = n end
-- Number conversion
local num = tonumber(size)
if num then
size = num

View File

@@ -1,15 +0,0 @@
return {
"romgrk/barbar.nvim",
event = "BufEnter",
dependencies = {
"lewis6991/gitsigns.nvim",
"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,6 +0,0 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = "BufEnter",
main = "ibl",
config = true
}

View File

@@ -1,30 +1,33 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = "L3MON4D3/LuaSnip",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
},
config = function()
local lsp_zero = require("lsp-zero")
lsp_zero.extend_cmp()
local cmp = require("cmp")
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
formatting = lsp_zero.cmp_format(),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered()
cmp.setup {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" }
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-f>"] = cmp_action.luasnip_jump_forward(),
["<C-b>"] = cmp_action.luasnip_jump_backward(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item()
})
})
}
end
}

View File

@@ -5,6 +5,12 @@ return {
filetypes = {
"*";
"!markdown";
"!neorg";
},
buftypes = {
"*",
"!prompt",
"!popup"
},
user_default_options = {
RRGGBBAA = true,

View File

@@ -2,6 +2,8 @@ return {
"LunarVim/bigfile.nvim",
"wakatime/vim-wakatime",
-- NOTE: Plugins
{
"nvim-pack/nvim-spectre",
dependencies = "nvim-lua/plenary.nvim"
@@ -20,21 +22,6 @@ return {
config = true
},
{
"andymass/vim-matchup",
event = "CursorMoved",
config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" }
end
},
{
"ellisonleao/glow.nvim",
cmd = "Glow",
config = true
},
-- NOTE: Git
{
"f-person/git-blame.nvim",
cmd = "GitBlameToggle"
@@ -53,66 +40,46 @@ return {
config = true
},
-- NOTE: LSP
{
"VonHeikemen/lsp-zero.nvim",
branch = "v3.x",
lazy = true,
config = false,
init = function()
local g = vim.g
g.lsp_zero_extend_cmp = 0
g.lsp_zero_extend_lspconfig = 0
end
},
{
"williamboman/mason.nvim",
lazy = false,
"lukas-reineke/indent-blankline.nvim",
event = "BufEnter",
main = "ibl",
config = true
},
-- NOTE: LSP
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
},
{
"ray-x/lsp_signature.nvim",
dependencies = "neovim/nvim-lspconfig",
config = true
},
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = true
},
{
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
cmd = "TroubleToggle",
config = true
},
{
"numToStr/Comment.nvim",
lazy = false,
config = true
},
{
"rmagatti/goto-preview",
opts = {
default_mappings = true
}
},
"RRethy/vim-illuminate",
-- NOTE: Flutter
{
"akinsho/flutter-tools.nvim",
lazy = false,

View File

@@ -1,27 +1,24 @@
return {
"neovim/nvim-lspconfig",
cmd = { "LspInfo", "LspInstall", "LspStart" },
event = { "BufReadPre", "BufNewFile" },
"williamboman/mason-lspconfig.nvim",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"williamboman/mason-lspconfig.nvim",
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp"
},
config = function()
local lsp_zero = require("lsp-zero")
lsp_zero.extend_lspconfig()
local lspconfig = require("lspconfig")
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
lsp_zero.on_attach(function(_, bufnr)
lsp_zero.default_keymaps({ buffer = bufnr })
end)
require("mason-lspconfig").setup({
handlers = {
lsp_zero.default_setup,
lua_ls = function()
local lua_opts = lsp_zero.nvim_lua_ls()
require("lspconfig").lua_ls.setup(lua_opts)
end,
local defaultSetup = function(server)
lspconfig[server].setup {
capabilities = lsp_capabilities
}
})
end
require("mason").setup()
require("mason-lspconfig").setup {
ensure_installed = {},
handlers = { defaultSetup }
}
end
}

View File

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

View File

@@ -1,19 +0,0 @@
return {
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = "nvim-lua/plenary.nvim",
opts = {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/Sync/Neorg"
},
default_workspace = "notes"
}
}
}
}
}

View File

@@ -1,24 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim"
},
cmd = "Neotree",
init = function()
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" })
end,
opts = {
close_if_last_window = true,
window = { width = "30" },
filesystem = {
follow_current_file = { enabled = true },
group_empty_dirs = true
}
}
}

View File

@@ -1,17 +1,21 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make"
}
},
config = function()
local telescope = require("telescope")
telescope.setup {
defaults = {
layout_strategy = "vertical",
file_ignore_patterns = { "node_modules" }
pickers = {
find_files = {
theme = "dropdown"
}
}
}

View File

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

@@ -2,14 +2,7 @@ return {
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
opts = {
style = "night",
styles = {
comments = { italic = true },
keywords = { italic = true, bold = true },
functions = { italic = true, bold = true },
variables = { bold = true }
},
lualine_bold = true
}
config = function()
vim.cmd[[colorscheme tokyonight-night]]
end
}

View File

@@ -16,8 +16,16 @@ return {
disable = { "dart" }
},
autotag = { enable = true },
matchup = { enable = true }
autotag = { enable = true }
}
end
end,
opts = {
ensure_installed = { "lua" },
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
autotag = { enable = true }
}
}

View File

@@ -6,7 +6,7 @@ local function config()
-- Finders
f = {
name = "Finders",
f = { "<cmd>Telescope fd<CR>", "Find files" },
f = { "<cmd>Telescope find_files<CR>", "Find files" },
w = { "<cmd>Telescope live_grep<CR>", "Text grep" },
s = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
t = { "<cmd>TodoTelescope<CR>", "Todos" },
@@ -14,15 +14,6 @@ local function config()
["."] = { "<cmd>Telescope keymaps<CR>", "Keymaps" }
},
-- Buffers
b = {
name = "Buffers",
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" }
},
-- Git
g = {
name = "Git",
@@ -48,7 +39,6 @@ local function config()
},
-- Misc
c = { "<cmd>BufferClose<CR>", "Close buffer" },
h = { "<cmd>noh<CR>", "No highlight" },
s = { "<cmd>SymbolsOutline<CR>", "Symbols outline" },
t = { "<cmd>TroubleToggle<CR>", "Toggle trouble" }
@@ -59,15 +49,11 @@ local function config()
t = { "<cmd>lua vim.lsp.buf.type_definition()<CR>", "type definition" }
},
-- Neotree
["<C-n>"] = { "<cmd>Neotree toggle<CR>", "Toggle neotree" },
-- 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" }
["<C-f>"] = { "<cmd>Telescope current_buffer_fuzzy_find<CR>", "Find in file" },
-- Misc
K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Hover" }
})
end
@@ -81,7 +67,7 @@ return {
end,
config = config,
opts = {
ignore_missing = false,
ignore_missing = true,
key_labels = {
["<space>"] = "SPC"
}