Update configuration

This commit is contained in:
Saeed Afzal
2022-09-24 14:56:23 +01:00
parent ab22aeeeb9
commit daaab2caad
13 changed files with 154 additions and 176 deletions

View File

@@ -1,6 +1,11 @@
local opt = vim.opt local opt = vim.opt
local g = vim.g local g = vim.g
-- Disable
g.loaded = 1
g.loaded_netrwPlugin = 1
-- Settings
g.mapleader = " " g.mapleader = " "
opt.backup = false opt.backup = false

View File

@@ -1,10 +1,18 @@
local nvim_tree_events = require("nvim-tree.events") local nvim_tree_events = require("nvim-tree.events")
local bufferline_state = require("bufferline.state") local bufferline_state = require("bufferline.state")
nvim_tree_events.on_tree_open(function() local function get_tree_size()
bufferline_state.set_offset(31, "File Tree") return require"nvim-tree.view".View.width
end
nvim_tree_events.subscribe("TreeOpen", function()
bufferline_state.set_offset(get_tree_size())
end) end)
nvim_tree_events.on_tree_close(function() nvim_tree_events.subscribe("Resize", function()
bufferline_state.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe("TreeClose", function()
bufferline_state.set_offset(0) bufferline_state.set_offset(0)
end) end)

View File

@@ -0,0 +1,3 @@
require("bufferline").setup {
maximum_length = 25
}

View File

@@ -1,14 +0,0 @@
vim.g.catppuccin_flavour = "mocha"
require("catppuccin").setup {
styles = {
loops = { "italic" },
functions = { "italic", "bold" }
},
integrations = {
lsp_trouble = true,
which_key = true,
barbar = true
}
}

View File

@@ -9,4 +9,5 @@ require("colorizer").setup(
hsl_fn = true, hsl_fn = true,
css = true, css = true,
css_fn = true css_fn = true
}) }
)

View File

@@ -1,11 +1,5 @@
require("lsp-setup").setup { require("lsp-setup").setup {
servers = { servers = {
sumneko_lua = {}, sumneko_lua = {}
tsserver = {},
gopls = {},
cssls = {},
jsonls = {},
html = {},
pylsp = {}
} }
} }

View File

@@ -1,10 +1,12 @@
require("lualine").setup { require("lualine").setup {
options = { options = {
theme = "catppuccin" theme = "tokyonight"
}, },
extensions = { extensions = {
"nvim-tree", "nvim-tree",
"toggleterm" "fzf",
"toggleterm",
"symbols-outline"
} }
} }

View File

@@ -1,17 +1,12 @@
require("nvim-tree").setup { require("nvim-tree").setup {
disable_netrw = true, -- view = {
create_in_closed_folder = true, -- hide_root_folder = true
hijack_cursor = true, -- },
update_cwd = true,
view = {
hide_root_folder = true
},
renderer = { renderer = {
highlight_git = true,
highlight_opened_files = "all",
group_empty = true, group_empty = true,
highlight_git = true,
indent_markers = { indent_markers = {
enable = true enable = true
} }
@@ -19,10 +14,14 @@ require("nvim-tree").setup {
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_cwd = true update_root = true
}, },
diagnostics = { diagnostics = {
enable = true enable = true
},
filters = {
custom = { ".git" }
} }
} }

View File

@@ -1,3 +1,6 @@
local g = vim.g require("tokyonight").setup {
style = "night",
lualine_bold = true
}
vim.g.tokyonight_italic_functions = true vim.cmd [[colorscheme tokyonight]]

View File

@@ -1,11 +1,3 @@
require("nvim-treesitter.configs").setup { require("nvim-treesitter.configs").setup {
ensure_installed = { "lua", "bash", "cpp", "css", "go", "gomod", "html", "javascript", "json", "make", "python", "typescript" }, ensure_installed = { "lua", "go", "typescript" }
highlight = {
enable = true
},
matchup = {
enable = true
}
} }

View File

@@ -1,8 +1,7 @@
local wk = require("which-key") local wk = require("which-key")
wk.setup { wk.setup {
-- TODO: Change to true ignore_missing = true,
ignore_missing = false,
key_labels = { key_labels = {
["<space>"] = "SPC" ["<space>"] = "SPC"
} }
@@ -10,62 +9,49 @@ wk.setup {
wk.register({ wk.register({
["<leader>"] = { ["<leader>"] = {
-- Files f = {
["<space>"] = { "<cmd>Telescope fd<CR>", "find files" }, name = "Find",
f = { "<cmd>Telescope fd<CR>", "find file" },
-- Buffers
b = {
name = "buffers",
x = { "<cmd>BufferClose<CR>", "close buffer" },
n = { "<cmd>BufferMoveNext<CR>", "move next" },
m = { "<cmd>BufferMovePrevious<CR>", "move previous" },
f = { "<cmd>Telescope current_buffer_fuzzy_find<CR>", "find in current buffer" },
p = {
name = "pinned buffers",
p = { "<cmd>BufferPin<CR>", "pin buffer" },
x = { "<cmd>BufferCloseAllButPinned<CR>", "close all but pinned" }
}
},
-- Telescope
t = {
name = "Telescope",
w = { "<cmd>Telescope live_grep<CR>", "live grep" }, w = { "<cmd>Telescope live_grep<CR>", "live grep" },
b = { "<cmd>Telescope buffers<CR>", "Buffers" }, b = { "<cmd>Telescope buffers<CR>", "all buffers" },
k = { "<cmd>Telescope keymaps<CR>", "Keymaps" }, t = { "<cmd>TodoTelescope<CR>", "todos" },
t = { "<cmd>TodoTelescope<CR>", "Todos" }, ["."] = { "<cmd>Telescope keymaps<CR>", "keymaps" }
c = { "<cmd>TodoTelescope<CR>", "" },
["."] = { "<cmd>Telescope keymaps<CR>", "Global Keymaps" }
}, },
-- Git
g = {
name = "Git",
b = { "<cmd>Gitsigns blame_line<CR>", "Blame Line" },
d = { "<cmd>Gitsigns diffthis<CR>", "Diff" }
},
-- LSP
l = { l = {
name = "LSP", name = "LSP",
a = { "<cmd>vim.lsp.buf.code_action()<CR>", "Code Action" }, r = { "<cmd>lua vim.lsp.buf.rename()<CR>", "rename" },
f = { "<cmd>vim.lsp.buf.formatting()<CR>", "Format" }, d = { "<cmd>Telescope diagnostics<CR>", "diagnostics" }
n = { "<cmd>vim.lsp.buf.rename()<CR>", "Rename" } },
}
b = {
name = "Buffer",
p = { "<cmd>BufferPick<CR>", "pick buffer" }
},
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" }
},
t = {
name = "Trouble",
t = { "<cmd>TroubleToggle<CR>", "toggle trouble" }
}, },
-- Nvim Tree -- Nvim Tree
["<C-n>"] = { "<cmd>NvimTreeToggle<CR>", "NvimTree Toggle" }, ["<C-n>"] = { "<cmd>NvimTreeToggle<CR>", "toggle nvimtree" },
-- Switching Buffers -- Switching Buffers
["<TAB>"] = { "<cmd>BufferNext<CR>", "Next Buffer" }, ["<TAB>"] = { "<cmd>BufferNext<CR>", "next buffer" },
["<S-TAB>"] = { "<cmd>BufferPrevious<CR>", "Previous Buffer" }, ["<S-TAB>"] = { "<cmd>BufferPrevious<CR>", "previous buffer" }
-- Trouble
["t"] = {
name = "Trouble",
t = { "<cmd>TroubleToggle<CR>", "Trouble Toggle" },
d = { "<cmd>TodoTrouble<CR>", "Todos" }
}
}) })

View File

@@ -1,12 +1,2 @@
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
packer_bootstrap = fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim",
install_path })
print("Installing packer: close and reopen Neovim...")
end
require("plugins.setup") require("plugins.setup")
require("plugins.barbar_nvimtree") require("plugins.barbar_nvimtree")
vim.cmd [[colorscheme catppuccin]]

View File

@@ -1,4 +1,25 @@
require("packer").startup(function(use) -- 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 "wbthomason/packer.nvim"
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
use "nathom/filetype.nvim" use "nathom/filetype.nvim"
@@ -10,18 +31,21 @@ require("packer").startup(function(use)
end end
} }
use "kyazdani42/nvim-web-devicons"
use { use {
"catppuccin/nvim", "kyazdani42/nvim-tree.lua",
as = "catppuccin", requires = "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("plugins.config.catppuccin") require("plugins.config.nvimtree")
end end
} }
use { use {
"kyazdani42/nvim-web-devicons", "romgrk/barbar.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("nvim-web-devicons").setup() require("plugins.config.barbar")
end end
} }
@@ -33,23 +57,6 @@ require("packer").startup(function(use)
end end
} }
use {
"andymass/vim-matchup",
after = "nvim-treesitter"
}
use {
"norcalli/nvim-colorizer.lua",
config = function()
require("plugins.config.colorizer")
end
}
use {
"romgrk/barbar.nvim",
requires = "kyazdani42/nvim-web-devicons"
}
use { use {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true }, requires = { "kyazdani42/nvim-web-devicons", opt = true },
@@ -59,10 +66,9 @@ require("packer").startup(function(use)
} }
use { use {
"kyazdani42/nvim-tree.lua", "norcalli/nvim-colorizer.lua",
requires = "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("plugins.config.nvimtree") require("plugins.config.colorizer")
end end
} }
@@ -80,31 +86,16 @@ require("packer").startup(function(use)
end end
} }
use "JoosepAlviste/nvim-ts-context-commentstring"
use { use {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
requires = "JoosepAlviste/nvim-ts-context-commentstring",
config = function() config = function()
require("Comment").setup() require("Comment").setup()
end end
} }
use {
"nvim-telescope/telescope-fzf-native.nvim",
run = "make"
}
use {
"nvim-telescope/telescope.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
require("plugins.config.telescope")
end
}
use { use {
"akinsho/toggleterm.nvim", "akinsho/toggleterm.nvim",
tag = "*",
config = function() config = function()
require("plugins.config.toggleterm") require("plugins.config.toggleterm")
end end
@@ -118,14 +109,21 @@ require("packer").startup(function(use)
end end
} }
-- Telescope
use { use {
"folke/which-key.nvim", "nvim-telescope/telescope-fzf-native.nvim",
run = "make"
}
use {
"nvim-telescope/telescope.nvim",
requires = "nvim-lua/plenary.nvim",
config = function() config = function()
require("plugins.config.whichkey") require("plugins.config.telescope")
end end
} }
-- NOTE: LSP -- LSP
use { use {
"junnplus/nvim-lsp-setup", "junnplus/nvim-lsp-setup",
requires = { requires = {
@@ -139,36 +137,33 @@ require("packer").startup(function(use)
} }
use { use {
"ray-x/lsp_signature.nvim",
after = "nvim-lspconfig",
config = function()
require("lsp_signature").setup()
end
}
use {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip"
}
use {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
{
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
requires = {
"L3MON4D3/LuaSnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-cmdline"
},
config = function() config = function()
require("plugins.config.cmp") require("plugins.config.cmp")
end end
} }
}
use { use {
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
event = "InsertCharPre" event = "InsertCharPre"
} }
use {
"ray-x/lsp_signature.nvim",
after = "nvim-lspconfig",
config = function()
require("lsp_signature").setup()
end
}
use { use {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
config = function() config = function()
@@ -192,6 +187,20 @@ require("packer").startup(function(use)
end 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
}
if packer_bootstrap then if packer_bootstrap then
require("packer").sync() require("packer").sync()
end end