Add tokyonight colourscheme

Optimise startup times for some plugins
Optimise LSP setup
This commit is contained in:
Evie Litherland-Smith 2023-05-17 14:57:53 +01:00
parent d99629439d
commit 84db975993
15 changed files with 72 additions and 52 deletions

View file

@ -1,3 +0,0 @@
indent_type = "Spaces"
call_parentheses = "None"
collapse_simple_statement = "Always"

View file

@ -1,4 +1,5 @@
vim.g.mapleader = " " vim.g.mapleader = " "
vim.opt.termguicolors = true
-- bootstrap lazy.nvim -- bootstrap lazy.nvim
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
@ -18,7 +19,7 @@ require("lazy").setup {
spec = "plugins", spec = "plugins",
lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json", lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json",
dev = { path = "~/Projects/lua/nvim" }, dev = { path = "~/Projects/lua/nvim" },
install = { colorscheme = { "catppuccin" } }, install = { colorscheme = { "tokyonight" } },
ui = { ui = {
border = "rounded", border = "rounded",
icons = { lazy = " " }, icons = { lazy = " " },
@ -42,6 +43,7 @@ require("lazy").setup {
} }
-- Set vim options -- Set vim options
vim.cmd([[colorscheme tokyonight]])
vim.opt.laststatus = 3 vim.opt.laststatus = 3
vim.opt.showtabline = 1 vim.opt.showtabline = 1
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4

View file

@ -1,24 +1,26 @@
-- LSP format call with options
local lsp_formatting = function(bufnr)
vim.lsp.buf.format {
bufnr = bufnr,
timeout_ms = 2000,
async = true,
}
end
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
-- Mappings. -- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr } local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("n", "gD", vim.lsp.buf.definition, bufopts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "gd", "<cmd>Trouble lsp_definitions<cr>", bufopts) vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
vim.keymap.set("n", "gR", vim.lsp.buf.references, bufopts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "gr", "<cmd>Trouble lsp_references<cr>", bufopts)
vim.keymap.set("n", "gI", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "gi", "<cmd>Trouble lsp_implementations<cr>", bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set("n", "<leader>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts)
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts) vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts) vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts) vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<leader>i", require "lsp.formatting", bufopts) vim.keymap.set("n", "<leader>i", lsp_formatting, bufopts)
if client.server_capabilities.documentSymbolProvider then if client.server_capabilities.documentSymbolProvider then
require("nvim-navic").attach(client, bufnr) require("nvim-navic").attach(client, bufnr)
require("nvim-navbuddy").attach(client, bufnr) require("nvim-navbuddy").attach(client, bufnr)

View file

@ -42,8 +42,8 @@ cmp.setup {
} }
-- Set configuration for specific filetype. -- Set configuration for specific filetype.
cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } }) -- cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } })
cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } }) -- cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } })
cmp.setup.cmdline("/", { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" } } }) cmp.setup.cmdline("/", { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" } } })
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),

View file

@ -1,8 +0,0 @@
local lsp_formatting = function(bufnr)
vim.lsp.buf.format {
bufnr = bufnr,
timeout_ms = 2000,
async = true,
}
end
return lsp_formatting

15
lua/plugins/barbecue.lua Normal file
View file

@ -0,0 +1,15 @@
return {
"utilyre/barbecue.nvim",
name = "barbecue",
version = "*",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons",
-- "catppuccin",
"folke/tokyonight.nvim",
},
opts = {
theme = 'tokyonight',
},
}

View file

@ -28,6 +28,7 @@ if vim.g.neovide then config.transparent_background = false end
return { return {
"catppuccin/nvim", "catppuccin/nvim",
enabled = false,
name = "catppuccin", name = "catppuccin",
lazy = false, lazy = false,
priority = 1000, priority = 1000,

View file

@ -1,11 +1,11 @@
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "SmiteshP/nvim-navic", "folke/noice.nvim" }, dependencies = { "nvim-tree/nvim-web-devicons", "folke/noice.nvim", "folke/tokyonight.nvim" },
event = { "BufReadPre", "BufNewFile" }, event = { "VeryLazy" },
config = true, config = true,
opts = { opts = {
options = { options = {
theme = "catppuccin", theme = "tokyonight",
component_separators = "|", component_separators = "|",
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
globalstatus = true, globalstatus = true,
@ -13,19 +13,12 @@ return {
sections = { sections = {
lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } }, lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" }, lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" },
lualine_c = { "diagnostics", "require('noice').api.status.lsp.get_hl()" }, lualine_c = { "diagnostics" },
lualine_x = { "filetype", "fileformat", "encoding" }, lualine_x = { "filetype", "fileformat", "encoding" },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "selectioncount", { "location", separator = { right = "" }, left_padding = 2 } }, lualine_z = { "selectioncount", { "location", separator = { right = "" }, left_padding = 2 } },
}, },
tabline = { tabline = {},
lualine_a = {},
lualine_b = {},
lualine_c = { "require('nvim-navic').get_location()" },
lualine_x = { "windows" },
lualine_y = {},
lualine_z = {},
},
winbar = {}, winbar = {},
extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" }, extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" },
}, },

View file

@ -1,3 +1,4 @@
return { return {
"dccsillag/magma-nvim", "dccsillag/magma-nvim",
event = { "BufReadPre", "BufNewFile" }
} }

View file

@ -6,14 +6,19 @@ return {
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
}, },
cmd = "NeoTree", cmd = "Neotree",
event = { "BufEnter" },
init = function() init = function()
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.g.neo_tree_remove_legacy_commands = 1 vim.g.neo_tree_remove_legacy_commands = 1
vim.keymap.set("n", "<leader>nn", "<cmd>Neotree left reveal reveal_force_cwd<cr>") vim.keymap.set("n", "<leader>nn", "<cmd>Neotree left reveal reveal_force_cwd<cr>")
vim.keymap.set("n", "<leader>nb", "<cmd>Neotree toggle show buffers right<cr>") vim.keymap.set("n", "<leader>nb", "<cmd>Neotree toggle show buffers right<cr>")
if vim.fn.argc() == 1 then
local stat = vim.loop.fs_stat(vim.fn.argv(0))
if stat and stat.type == "directory" then
require("neo-tree")
end
end
end, end,
config = true, config = true,
opts = { opts = {

View file

@ -1,5 +1,6 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = {"VeryLazy"},
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
@ -11,8 +12,8 @@ return {
enabled = true, enabled = true,
format = { format = {
"({data.progress.percentage}%) ", "({data.progress.percentage}%) ",
{ "{spinner} ", hl_group = "NoiceLspProgressSpinner" }, { "{spinner} ", hl_group = "NoiceLspProgressSpinner" },
{ "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" }, { "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" },
{ "{data.progress.client} ", hl_group = "NoiceLspProgressClient" }, { "{data.progress.client} ", hl_group = "NoiceLspProgressClient" },
}, },
}, },
@ -30,15 +31,13 @@ return {
win_options = { winblend = 0 }, win_options = { winblend = 0 },
}, },
}, },
status = { lsp = { event = "lsp", kind = "progress" } },
routes = { { view = "mini", filter = { event = "lsp", kind = "progress" }, opts = { skip = true } } },
-- you can enable a preset for easier configuration -- you can enable a preset for easier configuration
presets = { presets = {
bottom_search = false, -- use a classic bottom cmdline for search bottom_search = false, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = false, -- long messages will be sent to a splitnoice long_message_to_split = false, -- long messages will be sent to a splitnoice
inc_rename = true, -- enables an input dialog for inc-rename.nvim inc_rename = true, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help lsp_doc_border = true, -- add a border to hover docs and signature help
}, },
}, },
} }

View file

@ -1,9 +1,10 @@
return { return {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
dependencies = { "catppuccin" }, lazy = true,
-- dependencies = { "catppuccin" },
config = true, config = true,
opts = { opts = {
background_colour = require("catppuccin.palettes").get_palette("macchiato").base, -- background_colour = require("catppuccin.palettes").get_palette("macchiato").base,
fps = 60, fps = 60,
render = "default", -- "minimal", "simple" render = "default", -- "minimal", "simple"
}, },

View file

@ -0,0 +1,9 @@
return {
'folke/tokyonight.nvim',
lazy = true,
opts = {
transparent = false,
styles = { sidebars = "normal", floats = "transparent", }
},
config = true,
}

View file

@ -8,6 +8,7 @@ return {
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>") vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>")
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>") vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>")
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>") vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>")
vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>")
end, end,
config = true, config = true,
opts = { opts = {
@ -15,6 +16,7 @@ return {
auto_open = false, auto_open = false,
auto_close = false, auto_close = false,
auto_preview = true, auto_preview = true,
auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, auto_jump = { "lsp_definitions" },
use_diagnostic_signs = true,
}, },
} }

View file

@ -1,8 +1,9 @@
return { return {
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() event = { "VeryLazy"},
init = function()
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 300 vim.o.timeoutlen = 300
require("which-key").setup {}
end, end,
config = true,
} }