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 g = vim.g
-- Disable
g.loaded = 1
g.loaded_netrwPlugin = 1
-- Settings
g.mapleader = " "
opt.backup = false

View File

@@ -1,10 +1,18 @@
local nvim_tree_events = require("nvim-tree.events")
local bufferline_state = require("bufferline.state")
nvim_tree_events.on_tree_open(function()
bufferline_state.set_offset(31, "File Tree")
local function get_tree_size()
return require"nvim-tree.view".View.width
end
nvim_tree_events.subscribe("TreeOpen", function()
bufferline_state.set_offset(get_tree_size())
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)
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,
css = true,
css_fn = true
})
}
)

View File

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

View File

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

View File

@@ -1,17 +1,12 @@
require("nvim-tree").setup {
disable_netrw = true,
create_in_closed_folder = true,
hijack_cursor = true,
update_cwd = true,
view = {
hide_root_folder = true
},
-- view = {
-- hide_root_folder = true
-- },
renderer = {
highlight_git = true,
highlight_opened_files = "all",
group_empty = true,
highlight_git = true,
indent_markers = {
enable = true
}
@@ -19,10 +14,14 @@ require("nvim-tree").setup {
update_focused_file = {
enable = true,
update_cwd = true
update_root = true
},
diagnostics = {
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 {
ensure_installed = { "lua", "bash", "cpp", "css", "go", "gomod", "html", "javascript", "json", "make", "python", "typescript" },
highlight = {
enable = true
},
matchup = {
enable = true
}
ensure_installed = { "lua", "go", "typescript" }
}

View File

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

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