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.opt.termguicolors = true
-- bootstrap lazy.nvim
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
@ -18,7 +19,7 @@ require("lazy").setup {
spec = "plugins",
lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json",
dev = { path = "~/Projects/lua/nvim" },
install = { colorscheme = { "catppuccin" } },
install = { colorscheme = { "tokyonight" } },
ui = {
border = "rounded",
icons = { lazy = " " },
@ -42,6 +43,7 @@ require("lazy").setup {
}
-- Set vim options
vim.cmd([[colorscheme tokyonight]])
vim.opt.laststatus = 3
vim.opt.showtabline = 1
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
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr }
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", "<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", "gd", vim.lsp.buf.definition, 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", "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>rn", vim.lsp.buf.rename, 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
require("nvim-navic").attach(client, bufnr)
require("nvim-navbuddy").attach(client, bufnr)

View file

@ -42,8 +42,8 @@ cmp.setup {
}
-- Set configuration for specific filetype.
cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } })
cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } })
-- cmp.setup.filetype("python", { 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(),

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 {
"catppuccin/nvim",
enabled = false,
name = "catppuccin",
lazy = false,
priority = 1000,

View file

@ -1,11 +1,11 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "SmiteshP/nvim-navic", "folke/noice.nvim" },
event = { "BufReadPre", "BufNewFile" },
dependencies = { "nvim-tree/nvim-web-devicons", "folke/noice.nvim", "folke/tokyonight.nvim" },
event = { "VeryLazy" },
config = true,
opts = {
options = {
theme = "catppuccin",
theme = "tokyonight",
component_separators = "|",
section_separators = { left = "", right = "" },
globalstatus = true,
@ -13,19 +13,12 @@ return {
sections = {
lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
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_y = { "progress" },
lualine_z = { "selectioncount", { "location", separator = { right = "" }, left_padding = 2 } },
},
tabline = {
lualine_a = {},
lualine_b = {},
lualine_c = { "require('nvim-navic').get_location()" },
lualine_x = { "windows" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" },
},

View file

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

View file

@ -6,14 +6,19 @@ return {
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
cmd = "NeoTree",
event = { "BufEnter" },
cmd = "Neotree",
init = function()
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 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>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,
config = true,
opts = {

View file

@ -1,5 +1,6 @@
return {
"folke/noice.nvim",
event = {"VeryLazy"},
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
@ -30,8 +31,6 @@ return {
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
presets = {
bottom_search = false, -- use a classic bottom cmdline for search

View file

@ -1,9 +1,10 @@
return {
"rcarriga/nvim-notify",
dependencies = { "catppuccin" },
lazy = true,
-- dependencies = { "catppuccin" },
config = true,
opts = {
background_colour = require("catppuccin.palettes").get_palette("macchiato").base,
-- background_colour = require("catppuccin.palettes").get_palette("macchiato").base,
fps = 60,
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>xq", "<cmd>TroubleToggle quickfix<cr>")
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>")
vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>")
end,
config = true,
opts = {
@ -15,6 +16,7 @@ return {
auto_open = false,
auto_close = false,
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 {
"folke/which-key.nvim",
config = function()
event = { "VeryLazy"},
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup {}
end,
config = true,
}