Add stylua formatting file, change tabs back to spaces

This commit is contained in:
Evie Litherland-Smith 2023-02-17 16:35:40 +00:00
parent bb64daece4
commit 4c8a1623f0
22 changed files with 791 additions and 917 deletions

3
config/nvim/.stylua.toml Normal file
View file

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

View file

@ -1,11 +1,11 @@
vim.opt.fillchars:append({
horiz = '',
horizup = '',
horizdown = '',
vert = '',
vertleft = '',
vertright = '',
verthoriz = '',
})
require("config.catppuccin")
vim.cmd("colorscheme catppuccin")
vim.opt.fillchars:append {
horiz = "",
horizup = "",
horizdown = "",
vert = "",
vertleft = "",
vertright = "",
verthoriz = "",
}
require "config.catppuccin"
vim.cmd "colorscheme catppuccin"

View file

@ -1,4 +1,4 @@
require("catppuccin").setup({
require("catppuccin").setup {
flavour = "macchiato",
transparent_background = true,
term_colors = true,
@ -10,13 +10,13 @@ require("catppuccin").setup({
},
cmp = true,
native_lsp = {
enabled = true
enabled = true,
},
notify = true,
nvimtree = true,
treesitter = true,
treesitter_context = true,
telescope = true,
lsp_trouble = true
}
})
lsp_trouble = true,
},
}

View file

@ -1,7 +1,7 @@
local M = {}
local C = require("catppuccin.palettes").get_palette()
local lsp = require("feline.providers.lsp")
local lsp = require "feline.providers.lsp"
local assets = {
left_separator = "",
@ -35,14 +35,12 @@ local sett = {
}
if require("catppuccin").flavour == "latte" then
local latte = require("catppuccin.palettes").get_palette("latte")
local latte = require("catppuccin.palettes").get_palette "latte"
sett.text = latte.base
sett.bkg = latte.crust
end
if require("catppuccin").options.transparent_background then
sett.bkg = "NONE"
end
if require("catppuccin").options.transparent_background then sett.bkg = "NONE" end
local mode_colors = {
["n"] = { "NORMAL", C.lavender },
@ -89,9 +87,7 @@ function M.get()
}
local function is_enabled(min_width)
if shortline then
return true
end
if shortline then return true end
return vim.api.nvim_win_get_width(0) > min_width
end
@ -144,9 +140,7 @@ function M.get()
}
components.active[1][2] = {
provider = function()
return mode_colors[vim.fn.mode()][1] .. " "
end,
provider = function() return mode_colors[vim.fn.mode()][1] .. " " end,
hl = vi_mode_hl,
}
@ -165,9 +159,7 @@ function M.get()
bg = sett.bkg,
}
end,
enabled = function()
return not any_git_changes()
end,
enabled = function() return not any_git_changes() end,
}
-- enable if git diffs are available
@ -179,9 +171,7 @@ function M.get()
bg = sett.diffs,
}
end,
enabled = function()
return any_git_changes()
end,
enabled = function() return any_git_changes() end,
}
-- Current vi mode ------>
@ -219,9 +209,7 @@ function M.get()
fg = sett.bkg,
bg = sett.diffs,
},
enabled = function()
return any_git_changes()
end,
enabled = function() return any_git_changes() end,
}
components.active[1][9] = {
@ -230,9 +218,7 @@ function M.get()
fg = sett.diffs,
bg = sett.bkg,
},
enabled = function()
return any_git_changes()
end,
enabled = function() return any_git_changes() end,
}
-- Diffs ------>
@ -241,12 +227,12 @@ function M.get()
-- file progess
components.active[1][10] = {
provider = function()
local current_line = vim.fn.line(".")
local total_line = vim.fn.line("$")
local current_line = vim.fn.line "."
local total_line = vim.fn.line "$"
if current_line == 1 then
return "Top"
elseif current_line == vim.fn.line("$") then
elseif current_line == vim.fn.line "$" then
return "Bot"
end
local result, _ = math.modf((current_line / total_line) * 100)
@ -278,9 +264,7 @@ function M.get()
-- macro
components.active[1][12] = {
provider = "macro",
enabled = function()
return vim.api.nvim_get_option("cmdheight") == 0
end,
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
hl = {
fg = sett.extras,
bg = sett.bkg,
@ -291,9 +275,7 @@ function M.get()
-- search count
components.active[1][13] = {
provider = "search_count",
enabled = function()
return vim.api.nvim_get_option("cmdheight") == 0
end,
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
hl = {
fg = sett.extras,
bg = sett.bkg,
@ -309,15 +291,11 @@ function M.get()
-- if not require("vim.treesitter.language").require_language("lua") then
-- return ""
-- end
local pos = require("nvim-treesitter").statusline({
local pos = require("nvim-treesitter").statusline {
indicator_size = 50,
transform_fn = function(line)
return line:gsub("%s*[%[%(%{]+.*$", "")
end,
})
if pos and pos ~= "" then
return pos
end
transform_fn = function(line) return line:gsub("%s*[%[%(%{]+.*$", "") end,
}
if pos and pos ~= "" then return pos end
return ""
end,
hl = {
@ -338,9 +316,7 @@ function M.get()
if Lsp then
local msg = Lsp.message or ""
local percentage = Lsp.percentage
if not percentage then
return ""
end
if not percentage then return "" end
local title = Lsp.title or ""
local spinners = {
"",
@ -401,9 +377,7 @@ function M.get()
-- genral diagnostics (errors, warnings. info and hints)
components.active[2][4] = {
provider = "diagnostic_errors",
enabled = function()
return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR)
end,
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end,
hl = {
fg = C.red,
@ -415,9 +389,7 @@ function M.get()
components.active[2][5] = {
provider = "diagnostic_warnings",
enabled = function()
return lsp.diagnostics_exist(vim.diagnostic.severity.WARN)
end,
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end,
hl = {
fg = C.yellow,
bg = sett.bkg,
@ -428,9 +400,7 @@ function M.get()
components.active[2][6] = {
provider = "diagnostic_info",
enabled = function()
return lsp.diagnostics_exist(vim.diagnostic.severity.INFO)
end,
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end,
hl = {
fg = C.sky,
bg = sett.bkg,
@ -441,9 +411,7 @@ function M.get()
components.active[2][7] = {
provider = "diagnostic_hints",
enabled = function()
return lsp.diagnostics_exist(vim.diagnostic.severity.HINT)
end,
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end,
hl = {
fg = C.rosewater,
bg = sett.bkg,
@ -455,8 +423,8 @@ function M.get()
components.active[2][8] = {
provider = function()
local filename = vim.fn.expand("%:t")
local extension = vim.fn.expand("%:e")
local filename = vim.fn.expand "%:t"
local extension = vim.fn.expand "%:e"
local present, icons = pcall(require, "nvim-web-devicons")
local icon = present and icons.get_icon(filename, extension) or assets.file
return (sett.show_modified and "%m" or "") .. " " .. icon .. " " .. filename .. " "
@ -497,9 +465,7 @@ function M.get()
-- Inanctive components
components.inactive[1][1] = {
provider = function()
return " " .. string.upper(vim.bo.ft) .. " "
end,
provider = function() return " " .. string.upper(vim.bo.ft) .. " " end,
hl = {
fg = C.overlay2,
bg = C.mantle,

View file

@ -1,22 +1,22 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
local cmp = require "cmp"
local luasnip = require "luasnip"
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
mapping = cmp.mapping.preset.insert {
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
@ -35,13 +35,13 @@ cmp.setup({
fallback()
end
end, { "i", "s" }),
}),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "latex_symbols" },
},
})
}
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {

View file

@ -1,4 +1,2 @@
local components = require("config.catppuccin_feline").get()
require("feline").setup({
components = components,
})
require("feline").setup { components = components }

View file

@ -1,4 +1,4 @@
require("gitsigns").setup({
require("gitsigns").setup {
signcolumn = true,
numhl = true,
linehl = false,
@ -15,22 +15,14 @@ require("gitsigns").setup({
-- Navigation
map("n", "]c", function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
gs.next_hunk()
end)
if vim.wo.diff then return "]c" end
vim.schedule(function() gs.next_hunk() end)
return "<Ignore>"
end, { expr = true })
map("n", "[c", function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
gs.prev_hunk()
end)
if vim.wo.diff then return "[c" end
vim.schedule(function() gs.prev_hunk() end)
return "<Ignore>"
end, { expr = true })
@ -41,17 +33,13 @@ require("gitsigns").setup({
map("n", "<leader>hu", gs.undo_stage_hunk)
map("n", "<leader>hR", gs.reset_buffer)
map("n", "<leader>hp", gs.preview_hunk)
map("n", "<leader>hb", function()
gs.blame_line({ full = true })
end)
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
map("n", "<leader>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
map("n", "<leader>hD", function()
gs.diffthis("~")
end)
map("n", "<leader>hD", function() gs.diffthis "~" end)
map("n", "<leader>td", gs.toggle_deleted)
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end,
})
}

View file

@ -1,4 +1,4 @@
require("indent_blankline").setup({
require("indent_blankline").setup {
show_current_context = true,
show_current_context_start = false,
char_highlight_list = {
@ -9,4 +9,4 @@ require("indent_blankline").setup({
"IndentBlanklineIndent5",
"IndentBlanklineIndent6",
},
})
}

View file

@ -1,4 +0,0 @@
require("kanagawa").setup({
transparent = true,
dimInactive = true,
})

View file

@ -13,14 +13,12 @@ for type, icon in pairs(signs) do
end
local lsp_formatting = function(bufnr)
vim.lsp.buf.format({
filter = function(client)
return client.name == "null-ls"
end,
vim.lsp.buf.format {
filter = function(client) return client.name == "null-ls" end,
bufnr = bufnr,
timeout_ms = 2000,
-- async = true,
})
}
end
-- Use an on_attach function to only map the following keys
@ -39,9 +37,7 @@ local on_attach = function(_, bufnr)
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>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)
@ -55,35 +51,35 @@ local lsp_flags = {
require("neodev").setup()
local lspconfig = require("lspconfig")
local lspconfig = require "lspconfig"
local capabilities = require("cmp_nvim_lsp").default_capabilities()
lspconfig.pyright.setup({
lspconfig.pyright.setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
}
lspconfig.fortls.setup({
lspconfig.fortls.setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
}
lspconfig.lua_ls.setup({
lspconfig.lua_ls.setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
}
lspconfig.texlab.setup({
lspconfig.texlab.setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
}
local null_ls = require("null-ls")
null_ls.setup({
local null_ls = require "null-ls"
null_ls.setup {
sources = {
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.diagnostics.mypy,
@ -99,4 +95,4 @@ null_ls.setup({
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
}

View file

@ -1,5 +0,0 @@
require("lualine").setup({
options = {
global_status = true
},
})

View file

@ -1,5 +1,5 @@
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
require("neo-tree").setup({
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
require("neo-tree").setup {
close_if_last_window = true,
filesystem = {
filtered_items = {
@ -18,4 +18,4 @@ require("neo-tree").setup({
winbar = true,
statusline = false,
},
})
}

View file

@ -1,6 +0,0 @@
require("nightfox").setup({
options = {
transparent = true,
},
})
require("nightfox").compile()

View file

@ -1,6 +1,6 @@
require("nvim-test").setup({
require("nvim-test").setup {
termOpts = {
direction = "horizontal",
keep_one = true,
},
})
}

View file

@ -1,40 +0,0 @@
require("project_nvim").setup({
-- Manual mode doesn't automatically change your root directory, so you have
-- the option to manually do so using `:ProjectRoot` command.
manual_mode = false,
-- Methods of detecting the root directory. **"lsp"** uses the native neovim
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
-- order matters: if one is not detected, the other is used as fallback. You
-- can also delete or rearangne the detection methods.
detection_methods = { "pattern", "lsp" },
-- All the patterns used to detect root dir, when **"pattern"** is in
-- detection_methods
patterns = { ".git", ".venv", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
-- Table of lsp clients to ignore by name
-- eg: { "efm", ... }
ignore_lsp = {},
-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},
-- Show hidden files in telescope
show_hidden = false,
-- When set to false, you will get a message when project.nvim changes your
-- directory.
silent_chdir = true,
-- What scope to change the directory, valid options are
-- * global (default)
-- * tab
-- * win
scope_chdir = "global",
-- Path where project.nvim will store the project history for use in
-- telescope
datapath = vim.fn.stdpath("data"),
})

View file

@ -1,7 +1,7 @@
require("telescope.actions")
local trouble = require("trouble.providers.telescope")
require "telescope.actions"
local trouble = require "trouble.providers.telescope"
require("telescope").setup({
require("telescope").setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
@ -25,7 +25,7 @@ require("telescope").setup({
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
})
}
require("telescope").load_extension("fzf")
require("telescope").load_extension("notify")
require("telescope").load_extension "fzf"
require("telescope").load_extension "notify"

View file

@ -1,7 +1,7 @@
require("nvim-treesitter.configs").setup({
require("nvim-treesitter.configs").setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = { "fortran" },
},
})
}

View file

@ -1,7 +1,7 @@
require("trouble").setup({
require("trouble").setup {
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, -- for the given modes, automatically jump if there is only a single result
})
}

View file

@ -5,24 +5,20 @@ local M = {
name = "catppuccin",
lazy = false,
priority = 1000,
config = function()
require("colours")
end,
config = function() require "colours" end,
},
{ "stevearc/dressing.nvim" },
{
"feline-nvim/feline.nvim",
config = function()
require("config.feline")
end,
config = function() require "config.feline" end,
},
{
"rcarriga/nvim-notify",
config = function()
require("notify").setup({
require("notify").setup {
background_colour = "#000000",
})
vim.notify = require("notify")
}
vim.notify = require "notify"
end,
},
{
@ -45,21 +41,17 @@ local M = {
{ "folke/neodev.nvim" },
},
config = function()
require("config.lsp")
require("config.cmp")
require "config.lsp"
require "config.cmp"
end,
},
{
"nvim-treesitter/nvim-treesitter",
config = function()
require("config.treesitter")
end,
config = function() require "config.treesitter" end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("config.gitsigns")
end,
config = function() require "config.gitsigns" end,
},
{
"nvim-neo-tree/neo-tree.nvim",
@ -70,9 +62,7 @@ local M = {
"MunifTanjim/nui.nvim",
},
cmd = "Neotree",
config = function()
require("config.neotree")
end,
config = function() require "config.neotree" end,
},
{
"nvim-telescope/telescope.nvim",
@ -85,42 +75,30 @@ local M = {
},
},
cmd = "Telescope",
config = function()
require("config.telescope")
end,
config = function() require "config.telescope" end,
},
{
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
cmd = "TroubleToggle",
config = function()
require("config.trouble")
end,
config = function() require "config.trouble" end,
},
{
"lukas-reineke/indent-blankline.nvim",
config = function()
require("config.indent_blankline")
end,
config = function() require "config.indent_blankline" end,
},
{
"numToStr/Navigator.nvim",
config = function()
require("Navigator").setup()
end,
config = function() require("Navigator").setup() end,
},
{
"klen/nvim-test",
config = function()
require("config.nvim-test")
end,
config = function() require "config.nvim-test" end,
},
{
"numToStr/Comment.nvim",
name = "Comment",
config = function()
require("Comment")
end,
config = function() require "Comment" end,
},
}
return M

View file

@ -1,6 +1,6 @@
-- TODO convert to lua
vim.cmd("let &t_ut=''") -- For kitty background colour support
vim.cmd([[
vim.cmd "let &t_ut=''" -- For kitty background colour support
vim.cmd [[
au BufRead,BufNewFile *.ipynb setlocal filetype=json
au BufRead,BufNewFile *.md setlocal spell
au BufRead,BufNewFile *.code-workspace setlocal filetype=json
@ -8,4 +8,4 @@ au BufRead,BufNewFile *.csv setlocal nowrap
au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd
au TermOpen * setlocal nonumber norelativenumber
syntax on
]])
]]