Add a few more formatters, run formatting on files

This commit is contained in:
Evie Litherland-Smith 2023-02-13 12:57:12 +00:00
parent d3ed6bae04
commit ac62702feb
20 changed files with 1035 additions and 999 deletions

View file

@ -1,7 +1,9 @@
# Personal dotfiles
Collection of various settings, configurations and other miscellaneous tools.
## Settings
- [neovim](https://neovim.io)
- [kitty](https://sw.kovidgoyal.net/kitty/)
- [lazygit](https://github.com/jesseduffield/lazygit)
@ -11,9 +13,11 @@ Collection of various settings, configurations and other miscellaneous tools.
- [zsh]() paths and aliases
## Fonts
- [NerdFonts symbols](https://github.com/ryanoasis/nerd-fonts)
## Binaries
- [EFM LSP]()
- [Lazygit]()
- [Lua LSP]()
@ -22,11 +26,13 @@ Collection of various settings, configurations and other miscellaneous tools.
- [Treesitter]()
## Templates
- SSH config
- Python package
- Crontab
## Installation
Run `make` to symlink configs and download extras.
`software.sh` (WIP) installs common programs.

View file

@ -1,7 +1,9 @@
# Vim config
Personal configuration and plugins for Vim
## Installing neovim AppImage
```bash
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
@ -9,23 +11,29 @@ mv nvim.appimage "$HOME/bin/nvim"
```
## Installing configuration
```bash
ln -s /path/to/config/nvim ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
```
### Install script
`install.sh` currently handles installing `Packer` and `pynvim`.
Will also update existing installs if already present.
### Installing `Packer` plugin manager
```bash
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
```
Plugin definitions are in `plugins.lua`, inside `vim` run `:PackerSync` to install plugins
## Enabling python support
Set up neovim specific virtual environment to install `pynvim` package:
```bash
python3 -m venv "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv"
source "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv/bin/activate"
@ -34,6 +42,7 @@ source deactivate
```
### Installing language servers using `pipx`
Install [pipx](https://pypa.github.io/pipx/) in chosen manner, e.g. as given in documentation:
```bash
@ -52,4 +61,5 @@ pipx install zimports
```
## Add LUA language server
Follow instructions from [sumneko/lua-language-server GitHub](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line).

View file

@ -1,11 +1,11 @@
-- Set vim options
require 'options'
require("options")
-- Load plugins as defined for Packer
require 'plugins'
require("plugins")
-- Define custom keymappings
require 'keymaps'
require("keymaps")
-- Remaining vim commands to be converted to lua
require 'vimcommands'
require("vimcommands")

View file

@ -1,75 +1,75 @@
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local cmp = require("cmp")
local luasnip = require("luasnip")
require('luasnip.loaders.from_vscode').lazy_load()
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
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 {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'latex_symbols' },
}
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
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({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "latex_symbols" },
},
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = {
{ name = 'git' },
{ name = 'commit' },
{ name = 'buffer' },
}
cmp.setup.filetype("gitcommit", {
sources = {
{ name = "git" },
{ name = "commit" },
{ name = "buffer" },
},
})
cmp.setup.filetype('markdown', {
sources = {
{ name = 'spell' },
{ name = 'buffer' },
},
cmp.setup.filetype("markdown", {
sources = {
{ name = "spell" },
{ name = "buffer" },
},
})
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(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'path' },
{ name = 'cmdline' }
}
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "path" },
{ name = "cmdline" },
},
})

View file

@ -31,50 +31,50 @@ local fmt = string.format
---@param n number
---@return string
local hex = function(n)
if n then
return fmt("#%06x", n)
end
if n then
return fmt("#%06x", n)
end
end
---Parse `style` string into nvim_set_hl options
---@param style string
---@return table
local function parse_style(style)
if not style or style == "NONE" then
return {}
end
if not style or style == "NONE" then
return {}
end
local result = {}
for token in string.gmatch(style, "([^,]+)") do
result[token] = true
end
local result = {}
for token in string.gmatch(style, "([^,]+)") do
result[token] = true
end
return result
return result
end
---Get highlight opts for a given highlight group name
---@param name string
---@return table
local function get_highlight(name)
local hl = vim.api.nvim_get_hl_by_name(name, true)
if hl.link then
return get_highlight(hl.link)
end
local hl = vim.api.nvim_get_hl_by_name(name, true)
if hl.link then
return get_highlight(hl.link)
end
local result = parse_style(hl.style)
result.fg = hl.foreground and hex(hl.foreground)
result.bg = hl.background and hex(hl.background)
result.sp = hl.special and hex(hl.special)
local result = parse_style(hl.style)
result.fg = hl.foreground and hex(hl.foreground)
result.bg = hl.background and hex(hl.background)
result.sp = hl.special and hex(hl.special)
return result
return result
end
---Set highlight group from provided table
---@param groups table
local function set_highlights(groups)
for group, opts in pairs(groups) do
vim.api.nvim_set_hl(0, group, opts)
end
for group, opts in pairs(groups) do
vim.api.nvim_set_hl(0, group, opts)
end
end
---Generate a color palette from the current applied colorscheme
@ -92,27 +92,27 @@ local function generate_pallet_from_colorscheme()
white = { index = 7, default = "#dfdfe0" },
}
local diagnostic_map = {
hint = { hl = "DiagnosticHint", default = color_map.green.default },
info = { hl = "DiagnosticInfo", default = color_map.blue.default },
warn = { hl = "DiagnosticWarn", default = color_map.yellow.default },
error = { hl = "DiagnosticError", default = color_map.red.default },
}
local diagnostic_map = {
hint = { hl = "DiagnosticHint", default = color_map.green.default },
info = { hl = "DiagnosticInfo", default = color_map.blue.default },
warn = { hl = "DiagnosticWarn", default = color_map.yellow.default },
error = { hl = "DiagnosticError", default = color_map.red.default },
}
local pallet = {}
for name, value in pairs(color_map) do
local global_name = "terminal_color_" .. value.index
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
end
local pallet = {}
for name, value in pairs(color_map) do
local global_name = "terminal_color_" .. value.index
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
end
for name, value in pairs(diagnostic_map) do
pallet[name] = get_highlight(value.hl).fg or value.default
end
for name, value in pairs(diagnostic_map) do
pallet[name] = get_highlight(value.hl).fg or value.default
end
pallet.sl = get_highlight("StatusLine")
pallet.sel = get_highlight("TabLineSel")
pallet.sl = get_highlight("StatusLine")
pallet.sel = get_highlight("TabLineSel")
return pallet
return pallet
end
---Generate user highlight groups based on the curent applied colorscheme
@ -120,7 +120,7 @@ end
---NOTE: This is a global because I dont known where this file will be in your config
---and it is needed for the autocmd below
_G._generate_user_statusline_highlights = function()
local pal = generate_pallet_from_colorscheme()
local pal = generate_pallet_from_colorscheme()
-- stylua: ignore
local sl_colors = {
@ -134,332 +134,333 @@ _G._generate_user_statusline_highlights = function()
White = { fg = pal.white, bg = pal.black },
}
local colors = {}
for name, value in pairs(sl_colors) do
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
end
local colors = {}
for name, value in pairs(sl_colors) do
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
end
local status = vim.o.background == "dark" and { fg = pal.black, bg = pal.white } or { fg = pal.white, bg = pal.black }
local status = vim.o.background == "dark" and { fg = pal.black, bg = pal.white }
or { fg = pal.white, bg = pal.black }
local groups = {
-- statusline
UserSLHint = { fg = pal.sl.bg, bg = pal.hint, bold = true },
UserSLInfo = { fg = pal.sl.bg, bg = pal.info, bold = true },
UserSLWarn = { fg = pal.sl.bg, bg = pal.warn, bold = true },
UserSLError = { fg = pal.sl.bg, bg = pal.error, bold = true },
UserSLStatus = { fg = status.fg, bg = status.bg, bold = true },
local groups = {
-- statusline
UserSLHint = { fg = pal.sl.bg, bg = pal.hint, bold = true },
UserSLInfo = { fg = pal.sl.bg, bg = pal.info, bold = true },
UserSLWarn = { fg = pal.sl.bg, bg = pal.warn, bold = true },
UserSLError = { fg = pal.sl.bg, bg = pal.error, bold = true },
UserSLStatus = { fg = status.fg, bg = status.bg, bold = true },
UserSLFtHint = { fg = pal.sel.bg, bg = pal.hint },
UserSLHintInfo = { fg = pal.hint, bg = pal.info },
UserSLInfoWarn = { fg = pal.info, bg = pal.warn },
UserSLWarnError = { fg = pal.warn, bg = pal.error },
UserSLErrorStatus = { fg = pal.error, bg = status.bg },
UserSLStatusBg = { fg = status.bg, bg = pal.sl.bg },
UserSLFtHint = { fg = pal.sel.bg, bg = pal.hint },
UserSLHintInfo = { fg = pal.hint, bg = pal.info },
UserSLInfoWarn = { fg = pal.info, bg = pal.warn },
UserSLWarnError = { fg = pal.warn, bg = pal.error },
UserSLErrorStatus = { fg = pal.error, bg = status.bg },
UserSLStatusBg = { fg = status.bg, bg = pal.sl.bg },
UserSLAlt = pal.sel,
UserSLAltSep = { fg = pal.sl.bg, bg = pal.sel.bg },
UserSLGitBranch = { fg = pal.yellow, bg = pal.sl.bg },
}
UserSLAlt = pal.sel,
UserSLAltSep = { fg = pal.sl.bg, bg = pal.sel.bg },
UserSLGitBranch = { fg = pal.yellow, bg = pal.sl.bg },
}
set_highlights(vim.tbl_extend("force", colors, groups))
set_highlights(vim.tbl_extend("force", colors, groups))
end
_generate_user_statusline_highlights()
vim.api.nvim_create_augroup("UserStatuslineHighlightGroups", { clear = true })
vim.api.nvim_create_autocmd({ "SessionLoadPost", "ColorScheme" }, {
callback = function()
_generate_user_statusline_highlights()
end,
callback = function()
_generate_user_statusline_highlights()
end,
})
----------------------------------------------------------------------------------------------------
-- Feline
local vi = {
-- Map vi mode to text name
text = {
n = "NORMAL",
no = "NORMAL",
i = "INSERT",
v = "VISUAL",
V = "V-LINE",
[""] = "V-BLOCK",
c = "COMMAND",
cv = "COMMAND",
ce = "COMMAND",
R = "REPLACE",
Rv = "REPLACE",
s = "SELECT",
S = "SELECT",
[""] = "SELECT",
t = "TERMINAL",
},
-- Map vi mode to text name
text = {
n = "NORMAL",
no = "NORMAL",
i = "INSERT",
v = "VISUAL",
V = "V-LINE",
[""] = "V-BLOCK",
c = "COMMAND",
cv = "COMMAND",
ce = "COMMAND",
R = "REPLACE",
Rv = "REPLACE",
s = "SELECT",
S = "SELECT",
[""] = "SELECT",
t = "TERMINAL",
},
-- Maps vi mode to highlight group color defined above
colors = {
n = "UserRvCyan",
no = "UserRvCyan",
i = "UserSLStatus",
v = "UserRvMagenta",
V = "UserRvMagenta",
[""] = "UserRvMagenta",
R = "UserRvRed",
Rv = "UserRvRed",
r = "UserRvBlue",
rm = "UserRvBlue",
s = "UserRvMagenta",
S = "UserRvMagenta",
[""] = "FelnMagenta",
c = "UserRvYellow",
["!"] = "UserRvBlue",
t = "UserRvBlue",
},
-- Maps vi mode to highlight group color defined above
colors = {
n = "UserRvCyan",
no = "UserRvCyan",
i = "UserSLStatus",
v = "UserRvMagenta",
V = "UserRvMagenta",
[""] = "UserRvMagenta",
R = "UserRvRed",
Rv = "UserRvRed",
r = "UserRvBlue",
rm = "UserRvBlue",
s = "UserRvMagenta",
S = "UserRvMagenta",
[""] = "FelnMagenta",
c = "UserRvYellow",
["!"] = "UserRvBlue",
t = "UserRvBlue",
},
-- Maps vi mode to seperator highlight goup defined above
sep = {
n = "UserCyan",
no = "UserCyan",
i = "UserSLStatusBg",
v = "UserMagenta",
V = "UserMagenta",
[""] = "UserMagenta",
R = "UserRed",
Rv = "UserRed",
r = "UserBlue",
rm = "UserBlue",
s = "UserMagenta",
S = "UserMagenta",
[""] = "FelnMagenta",
c = "UserYellow",
["!"] = "UserBlue",
t = "UserBlue",
},
-- Maps vi mode to seperator highlight goup defined above
sep = {
n = "UserCyan",
no = "UserCyan",
i = "UserSLStatusBg",
v = "UserMagenta",
V = "UserMagenta",
[""] = "UserMagenta",
R = "UserRed",
Rv = "UserRed",
r = "UserBlue",
rm = "UserBlue",
s = "UserMagenta",
S = "UserMagenta",
[""] = "FelnMagenta",
c = "UserYellow",
["!"] = "UserBlue",
t = "UserBlue",
},
}
local icons = {
locker = "", -- #f023
page = "", -- 2630
line_number = "", -- e0a1
connected = "", -- f817
dos = "", -- e70f
unix = "", -- f17c
mac = "", -- f179
mathematical_L = "𝑳",
vertical_bar = "",
vertical_bar_thin = "",
left = "",
right = "",
block = "",
left_filled = "",
right_filled = "",
slant_left = "",
slant_left_thin = "",
slant_right = "",
slant_right_thin = "",
slant_left_2 = "",
slant_left_2_thin = "",
slant_right_2 = "",
slant_right_2_thin = "",
left_rounded = "",
left_rounded_thin = "",
right_rounded = "",
right_rounded_thin = "",
circle = "",
locker = "", -- #f023
page = "", -- 2630
line_number = "", -- e0a1
connected = "", -- f817
dos = "", -- e70f
unix = "", -- f17c
mac = "", -- f179
mathematical_L = "𝑳",
vertical_bar = "",
vertical_bar_thin = "",
left = "",
right = "",
block = "",
left_filled = "",
right_filled = "",
slant_left = "",
slant_left_thin = "",
slant_right = "",
slant_right_thin = "",
slant_left_2 = "",
slant_left_2_thin = "",
slant_right_2 = "",
slant_right_2_thin = "",
left_rounded = "",
left_rounded_thin = "",
right_rounded = "",
right_rounded_thin = "",
circle = "",
}
---Get the number of diagnostic messages for the provided severity
---@param str string [ERROR | WARN | INFO | HINT]
---@return string
local function get_diag(str)
local diagnostics = vim.diagnostic.get(0, { severity = vim.diagnostic.severity[str] })
local count = #diagnostics
local diagnostics = vim.diagnostic.get(0, { severity = vim.diagnostic.severity[str] })
local count = #diagnostics
return (count > 0) and " " .. count .. " " or ""
return (count > 0) and " " .. count .. " " or ""
end
---Get highlight group from vi mode
---@return string
local function vi_mode_hl()
return vi.colors[vim.fn.mode()] or "UserSLViBlack"
return vi.colors[vim.fn.mode()] or "UserSLViBlack"
end
---Get sep highlight group from vi mode
local function vi_sep_hl()
return vi.sep[vim.fn.mode()] or "UserSLBlack"
return vi.sep[vim.fn.mode()] or "UserSLBlack"
end
---Get the path of the file relative to the cwd
---@return string
local function file_info()
local list = {}
if vim.bo.readonly then
table.insert(list, "🔒")
end
local list = {}
if vim.bo.readonly then
table.insert(list, "🔒")
end
if vim.bo.modified then
table.insert(list, "")
end
if vim.bo.modified then
table.insert(list, "")
end
table.insert(list, vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":~:."))
table.insert(list, vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":~:."))
return table.concat(list, " ")
return table.concat(list, " ")
end
-- Create a table that contians every status line commonent
local c = {
vimode = {
provider = function()
return fmt(" %s ", vi.text[vim.fn.mode()])
end,
hl = vi_mode_hl,
right_sep = { str = "", hl = vi_sep_hl },
},
gitbranch = {
provider = "git_branch",
icon = "",
hl = "UserSLGitBranch",
right_sep = { str = " ", hl = "UserSLGitBranch" },
enabled = function()
return vim.b.gitsigns_status_dict ~= nil
end,
},
file_type = {
provider = function()
return fmt(" %s ", vim.bo.filetype:upper())
end,
hl = "UserSLAlt",
},
fileinfo = {
provider = { name = "file_info", opts = { type = "relative" } },
hl = "UserSLAlt",
left_sep = { str = "", hl = "UserSLAltSep" },
right_sep = { str = "", hl = "UserSLAltSep" },
},
file_enc = {
provider = function()
local os = icons[vim.bo.fileformat] or ""
return fmt(" %s %s ", os, vim.bo.fileencoding)
end,
hl = "StatusLine",
left_sep = { str = icons.left_filled, hl = "UserSLAltSep" },
},
cur_position = {
provider = function()
-- TODO: What about 4+ diget line numbers?
return fmt(" %3d:%-2d ", unpack(vim.api.nvim_win_get_cursor(0)))
end,
hl = vi_mode_hl,
left_sep = { str = icons.left_filled, hl = vi_sep_hl },
},
cur_percent = {
provider = function()
return " " .. require("feline.providers.cursor").line_percentage() .. " "
end,
hl = vi_mode_hl,
left_sep = { str = icons.left, hl = vi_mode_hl },
},
default = { -- needed to pass the parent StatusLine hl group to right hand side
provider = "",
hl = "StatusLine",
},
lsp_status = {
provider = function()
return require("lsp-status").status()
end,
hl = "UserSLStatus",
left_sep = { str = "", hl = "UserSLStatusBg", always_visible = true },
right_sep = { str = "", hl = "UserSLErrorStatus", always_visible = true },
},
lsp_error = {
provider = function()
return get_diag("ERROR")
end,
hl = "UserSLError",
right_sep = { str = "", hl = "UserSLWarnError", always_visible = true },
},
lsp_warn = {
provider = function()
return get_diag("WARN")
end,
hl = "UserSLWarn",
right_sep = { str = "", hl = "UserSLInfoWarn", always_visible = true },
},
lsp_info = {
provider = function()
return get_diag("INFO")
end,
hl = "UserSLInfo",
right_sep = { str = "", hl = "UserSLHintInfo", always_visible = true },
},
lsp_hint = {
provider = function()
return get_diag("HINT")
end,
hl = "UserSLHint",
right_sep = { str = "", hl = "UserSLFtHint", always_visible = true },
},
vimode = {
provider = function()
return fmt(" %s ", vi.text[vim.fn.mode()])
end,
hl = vi_mode_hl,
right_sep = { str = "", hl = vi_sep_hl },
},
gitbranch = {
provider = "git_branch",
icon = "",
hl = "UserSLGitBranch",
right_sep = { str = " ", hl = "UserSLGitBranch" },
enabled = function()
return vim.b.gitsigns_status_dict ~= nil
end,
},
file_type = {
provider = function()
return fmt(" %s ", vim.bo.filetype:upper())
end,
hl = "UserSLAlt",
},
fileinfo = {
provider = { name = "file_info", opts = { type = "relative" } },
hl = "UserSLAlt",
left_sep = { str = "", hl = "UserSLAltSep" },
right_sep = { str = "", hl = "UserSLAltSep" },
},
file_enc = {
provider = function()
local os = icons[vim.bo.fileformat] or ""
return fmt(" %s %s ", os, vim.bo.fileencoding)
end,
hl = "StatusLine",
left_sep = { str = icons.left_filled, hl = "UserSLAltSep" },
},
cur_position = {
provider = function()
-- TODO: What about 4+ diget line numbers?
return fmt(" %3d:%-2d ", unpack(vim.api.nvim_win_get_cursor(0)))
end,
hl = vi_mode_hl,
left_sep = { str = icons.left_filled, hl = vi_sep_hl },
},
cur_percent = {
provider = function()
return " " .. require("feline.providers.cursor").line_percentage() .. " "
end,
hl = vi_mode_hl,
left_sep = { str = icons.left, hl = vi_mode_hl },
},
default = { -- needed to pass the parent StatusLine hl group to right hand side
provider = "",
hl = "StatusLine",
},
lsp_status = {
provider = function()
return require("lsp-status").status()
end,
hl = "UserSLStatus",
left_sep = { str = "", hl = "UserSLStatusBg", always_visible = true },
right_sep = { str = "", hl = "UserSLErrorStatus", always_visible = true },
},
lsp_error = {
provider = function()
return get_diag("ERROR")
end,
hl = "UserSLError",
right_sep = { str = "", hl = "UserSLWarnError", always_visible = true },
},
lsp_warn = {
provider = function()
return get_diag("WARN")
end,
hl = "UserSLWarn",
right_sep = { str = "", hl = "UserSLInfoWarn", always_visible = true },
},
lsp_info = {
provider = function()
return get_diag("INFO")
end,
hl = "UserSLInfo",
right_sep = { str = "", hl = "UserSLHintInfo", always_visible = true },
},
lsp_hint = {
provider = function()
return get_diag("HINT")
end,
hl = "UserSLHint",
right_sep = { str = "", hl = "UserSLFtHint", always_visible = true },
},
in_fileinfo = {
provider = "file_info",
hl = "StatusLine",
},
in_position = {
provider = "position",
hl = "StatusLine",
},
in_fileinfo = {
provider = "file_info",
hl = "StatusLine",
},
in_position = {
provider = "position",
hl = "StatusLine",
},
}
local active = {
{ -- left
c.vimode,
c.gitbranch,
c.fileinfo,
c.default, -- must be last
},
{ -- right
c.lsp_status,
c.lsp_error,
c.lsp_warn,
c.lsp_info,
c.lsp_hint,
c.file_type,
c.file_enc,
c.cur_position,
c.cur_percent,
},
{ -- left
c.vimode,
c.gitbranch,
c.fileinfo,
c.default, -- must be last
},
{ -- right
c.lsp_status,
c.lsp_error,
c.lsp_warn,
c.lsp_info,
c.lsp_hint,
c.file_type,
c.file_enc,
c.cur_position,
c.cur_percent,
},
}
local inactive = {
{ c.in_fileinfo }, -- left
{ c.in_position }, -- right
{ c.in_fileinfo }, -- left
{ c.in_position }, -- right
}
require("feline").setup({
components = { active = active, inactive = inactive },
highlight_reset_triggers = {},
force_inactive = {
filetypes = {
"NvimTree",
"Trouble",
"packer",
"dap-repl",
"dapui_scopes",
"dapui_stacks",
"dapui_watches",
"dapui_repl",
"LspTrouble",
"qf",
"help",
},
buftypes = { "terminal" },
bufnames = {},
},
disable = {
filetypes = {
"dashboard",
"startify",
},
},
components = { active = active, inactive = inactive },
highlight_reset_triggers = {},
force_inactive = {
filetypes = {
"NvimTree",
"Trouble",
"packer",
"dap-repl",
"dapui_scopes",
"dapui_stacks",
"dapui_watches",
"dapui_repl",
"LspTrouble",
"qf",
"help",
},
buftypes = { "terminal" },
bufnames = {},
},
disable = {
filetypes = {
"dashboard",
"startify",
},
},
})

View file

@ -1,45 +1,57 @@
require('gitsigns').setup {
signcolumn = true,
numhl = true,
linehl = false,
current_line_blame = true,
word_diff = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
require("gitsigns").setup({
signcolumn = true,
numhl = true,
linehl = false,
current_line_blame = true,
word_diff = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true })
-- Navigation
map("n", "]c", function()
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)
return '<Ignore>'
end, { expr = true })
map("n", "[c", function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
map('n', '<leader>hS', gs.stage_buffer)
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>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
-- Actions
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
map("n", "<leader>hS", gs.stage_buffer)
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>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
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,
}
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end,
})

View file

@ -1,119 +1,124 @@
local lsp_status = require('lsp-status')
lsp_status.config {
diagnostics = false,
}
local lsp_status = require("lsp-status")
lsp_status.config({
diagnostics = false,
})
lsp_status.register_progress()
-- Set up null_ls first
local null_ls = require("null-ls")
null_ls.setup {
sources = {
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.diagnostics.mypy,
null_ls.builtins.diagnostics.zsh,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.latexindent,
null_ls.builtins.formatting.trim_whitespace,
null_ls.builtins.hover.dictionary,
},
}
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local lsp_formatting = function (bufnr)
vim.lsp.buf.format({
filter = function (client)
return client.name == "null-ls"
end,
bufnr = bufnr,
timeout_ms = 2000,
-- async = true,
})
local lsp_formatting = function(bufnr)
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
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
lsp_status.on_attach(client)
-- 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', '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', lsp_formatting, bufopts)
lsp_status.on_attach(client)
-- 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", "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", lsp_formatting, bufopts)
end
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
local capabilities = vim.tbl_extend('keep', require('cmp_nvim_lsp').default_capabilities(), lsp_status.capabilities)
local capabilities = vim.tbl_extend("keep", require("cmp_nvim_lsp").default_capabilities(), lsp_status.capabilities)
require('lspconfig')['pyright'].setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
-- Set up null_ls first
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.diagnostics.mypy,
null_ls.builtins.diagnostics.zsh,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.trim_whitespace,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.shfmt,
null_ls.builtins.formatting.prettier,
null_ls.builtins.hover.dictionary,
},
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
require('lspconfig')['fortls'].setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities
}
require("lspconfig")["pyright"].setup({
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
require('lspconfig')['sumneko_lua'].setup {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
},
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require("lspconfig")["fortls"].setup({
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
require('lspconfig')['texlab'].setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require("lspconfig")["sumneko_lua"].setup({
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
},
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})
require("lspconfig")["texlab"].setup({
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
})

View file

@ -1,7 +1,7 @@
require('nightfox').setup {
options = {
transparent = true,
},
}
require('nightfox').compile()
require("nightfox").setup({
options = {
transparent = true,
},
})
require("nightfox").compile()
vim.cmd("colorscheme nightfox")

View file

@ -1,65 +1,65 @@
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require('nvim-tree').setup {
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
},
diagnostics = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
git = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
view = {
centralize_selection = true,
},
renderer = {
add_trailing = true,
group_empty = true,
full_name = true,
highlight_git = true,
highlight_modified = "all",
indent_markers = {
enable = true,
},
icons = {
show = {
git = false,
modified = false,
},
},
},
filters = {
dotfiles = true,
},
}
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
},
diagnostics = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
git = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
view = {
centralize_selection = true,
},
renderer = {
add_trailing = true,
group_empty = true,
full_name = true,
highlight_git = true,
highlight_modified = "all",
indent_markers = {
enable = true,
},
icons = {
show = {
git = false,
modified = false,
},
},
},
filters = {
dotfiles = true,
},
})
local function open_nvim_tree(data)
-- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
if not no_name then
return
end
if not no_name then
return
end
-- open the tree, find the file but don't focus it
require("nvim-tree.api").tree.toggle({ focus = false })
-- open the tree, find the file but don't focus it
require("nvim-tree.api").tree.toggle({ focus = false })
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

View file

@ -1,40 +1,40 @@
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,
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" },
-- 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" },
-- 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 = {},
-- Table of lsp clients to ignore by name
-- eg: { "efm", ... }
ignore_lsp = {},
-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},
-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},
-- Show hidden files in telescope
show_hidden = false,
-- 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,
-- 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',
-- 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"),
}
-- Path where project.nvim will store the project history for use in
-- telescope
datapath = vim.fn.stdpath("data"),
})

View file

@ -31,50 +31,50 @@ local fmt = string.format
---@param n number
---@return string
local hex = function(n)
if n then
return fmt("#%06x", n)
end
if n then
return fmt("#%06x", n)
end
end
---Parse `style` string into nvim_set_hl options
---@param style string
---@return table
local function parse_style(style)
if not style or style == "NONE" then
return {}
end
if not style or style == "NONE" then
return {}
end
local result = {}
for token in string.gmatch(style, "([^,]+)") do
result[token] = true
end
local result = {}
for token in string.gmatch(style, "([^,]+)") do
result[token] = true
end
return result
return result
end
---Get highlight opts for a given highlight group name
---@param name string
---@return table
local function get_highlight(name)
local hl = vim.api.nvim_get_hl_by_name(name, true)
if hl.link then
return get_highlight(hl.link)
end
local hl = vim.api.nvim_get_hl_by_name(name, true)
if hl.link then
return get_highlight(hl.link)
end
local result = parse_style(hl.style)
result.fg = hl.foreground and hex(hl.foreground)
result.bg = hl.background and hex(hl.background)
result.sp = hl.special and hex(hl.special)
local result = parse_style(hl.style)
result.fg = hl.foreground and hex(hl.foreground)
result.bg = hl.background and hex(hl.background)
result.sp = hl.special and hex(hl.special)
return result
return result
end
---Set highlight group from provided table
---@param groups table
local function set_highlights(groups)
for group, opts in pairs(groups) do
vim.api.nvim_set_hl(0, group, opts)
end
for group, opts in pairs(groups) do
vim.api.nvim_set_hl(0, group, opts)
end
end
---Generate a color palette from the current applied colorscheme
@ -92,18 +92,18 @@ local function generate_pallet_from_colorscheme()
white = { index = 7, default = "#dfdfe0" },
}
local pallet = {}
for name, value in pairs(color_map) do
local global_name = "terminal_color_" .. value.index
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
end
local pallet = {}
for name, value in pairs(color_map) do
local global_name = "terminal_color_" .. value.index
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
end
pallet.sl = get_highlight("StatusLine")
pallet.tab = get_highlight("TabLine")
pallet.sel = get_highlight("TabLineSel")
pallet.fill = get_highlight("TabLineFill")
pallet.sl = get_highlight("StatusLine")
pallet.tab = get_highlight("TabLine")
pallet.sel = get_highlight("TabLineSel")
pallet.fill = get_highlight("TabLineFill")
return pallet
return pallet
end
---Generate user highlight groups based on the curent applied colorscheme
@ -111,7 +111,7 @@ end
---NOTE: This is a global because I dont known where this file will be in your config
---and it is needed for the autocmd below
_G._genreate_user_tabline_highlights = function()
local pal = generate_pallet_from_colorscheme()
local pal = generate_pallet_from_colorscheme()
-- stylua: ignore
local sl_colors = {
@ -125,32 +125,32 @@ _G._genreate_user_tabline_highlights = function()
White = { fg = pal.white, bg = pal.black },
}
local colors = {}
for name, value in pairs(sl_colors) do
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
end
local colors = {}
for name, value in pairs(sl_colors) do
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
end
local groups = {
-- tabline
UserTLHead = { fg = pal.fill.bg, bg = pal.cyan },
UserTLHeadSep = { fg = pal.cyan, bg = pal.fill.bg },
UserTLActive = { fg = pal.sel.fg, bg = pal.sel.bg, bold = true },
UserTLActiveSep = { fg = pal.sel.bg, bg = pal.fill.bg },
UserTLBoldLine = { fg = pal.tab.fg, bg = pal.tab.bg, bold = true },
UserTLLineSep = { fg = pal.tab.bg, bg = pal.fill.bg },
}
local groups = {
-- tabline
UserTLHead = { fg = pal.fill.bg, bg = pal.cyan },
UserTLHeadSep = { fg = pal.cyan, bg = pal.fill.bg },
UserTLActive = { fg = pal.sel.fg, bg = pal.sel.bg, bold = true },
UserTLActiveSep = { fg = pal.sel.bg, bg = pal.fill.bg },
UserTLBoldLine = { fg = pal.tab.fg, bg = pal.tab.bg, bold = true },
UserTLLineSep = { fg = pal.tab.bg, bg = pal.fill.bg },
}
set_highlights(vim.tbl_extend("force", colors, groups))
set_highlights(vim.tbl_extend("force", colors, groups))
end
_genreate_user_tabline_highlights()
vim.api.nvim_create_augroup("UserTablineHighlightGroups", { clear = true })
vim.api.nvim_create_autocmd({ "SessionLoadPost", "ColorScheme" }, {
callback = function()
_genreate_user_tabline_highlights()
end,
callback = function()
_genreate_user_tabline_highlights()
end,
})
----------------------------------------------------------------------------------------------------
@ -159,62 +159,62 @@ vim.api.nvim_create_autocmd({ "SessionLoadPost", "ColorScheme" }, {
local filename = require("tabby.module.filename")
local cwd = function()
return "" .. vim.fn.fnamemodify(vim.fn.getcwd(), ":t") .. " "
return "" .. vim.fn.fnamemodify(vim.fn.getcwd(), ":t") .. " "
end
local line = {
hl = "TabLineFill",
layout = "active_wins_at_tail",
head = {
{ cwd, hl = "UserTLHead" },
{ "", hl = "UserTLHeadSep" },
},
active_tab = {
label = function(tabid)
return {
"" .. tabid .. " ",
hl = "UserTLActive",
}
end,
left_sep = { "", hl = "UserTLActiveSep" },
right_sep = { "", hl = "UserTLActiveSep" },
},
inactive_tab = {
label = function(tabid)
return {
"" .. tabid .. " ",
hl = "UserTLBoldLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
top_win = {
label = function(winid)
return {
"" .. filename.unique(winid) .. " ",
hl = "TabLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
win = {
label = function(winid)
return {
"" .. filename.unique(winid) .. " ",
hl = "TabLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
tail = {
{ "", hl = "UserTLHeadSep" },
{ "", hl = "UserTLHead" },
},
hl = "TabLineFill",
layout = "active_wins_at_tail",
head = {
{ cwd, hl = "UserTLHead" },
{ "", hl = "UserTLHeadSep" },
},
active_tab = {
label = function(tabid)
return {
"" .. tabid .. " ",
hl = "UserTLActive",
}
end,
left_sep = { "", hl = "UserTLActiveSep" },
right_sep = { "", hl = "UserTLActiveSep" },
},
inactive_tab = {
label = function(tabid)
return {
"" .. tabid .. " ",
hl = "UserTLBoldLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
top_win = {
label = function(winid)
return {
"" .. filename.unique(winid) .. " ",
hl = "TabLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
win = {
label = function(winid)
return {
"" .. filename.unique(winid) .. " ",
hl = "TabLine",
}
end,
left_sep = { "", hl = "UserTLLineSep" },
right_sep = { "", hl = "UserTLLineSep" },
},
tail = {
{ "", hl = "UserTLHeadSep" },
{ "", hl = "UserTLHead" },
},
}
require("tabby").setup({
tabline = line,
tabline = line,
})

View file

@ -1,32 +1,32 @@
require('telescope.actions')
local trouble = require('trouble.providers.telescope')
require("telescope.actions")
local trouble = require("trouble.providers.telescope")
require('telescope').setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
aerial = {
show_nesting = {
["_"] = false,
python = true,
json = true,
yaml = true,
},
},
},
defaults = {
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
}
require("telescope").setup({
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
aerial = {
show_nesting = {
["_"] = false,
python = true,
json = true,
yaml = true,
},
},
},
defaults = {
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
})
require('telescope').load_extension('fzf')
require('telescope').load_extension('notify')
require('telescope').load_extension('projects')
require("telescope").load_extension("fzf")
require("telescope").load_extension("notify")
require("telescope").load_extension("projects")

View file

@ -1,22 +1,22 @@
require('toggleterm').setup {
direction = 'horizontal',
open_mapping = [[\t]],
size = function (term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.3
end
end,
hide_numbers = true, -- hide the number column in toggleterm buffers
persist_size = false,
float_opts = {
border = 'curved',
},
winbar = {
enabled = false,
name_formatter = function(term) -- term: Terminal
return term.name
end
},
}
require("toggleterm").setup({
direction = "horizontal",
open_mapping = [[\t]],
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.3
end
end,
hide_numbers = true, -- hide the number column in toggleterm buffers
persist_size = false,
float_opts = {
border = "curved",
},
winbar = {
enabled = false,
name_formatter = function(term) -- term: Terminal
return term.name
end,
},
})

View file

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

View file

@ -1,47 +1,47 @@
require('trouble').setup {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = true, -- 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_fold = false, -- automatically fold a file trouble list at creation
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
}
require("trouble").setup({
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = true, -- 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_fold = false, -- automatically fold a file trouble list at creation
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
})

View file

@ -1,39 +1,39 @@
vim.g.mapleader = ' '
vim.keymap.set('i', 'jk', '<esc>')
vim.g.mapleader = " "
vim.keymap.set("i", "jk", "<esc>")
-- Toggleterm
vim.keymap.set('n', '<leader>th', '<cmd>ToggleTerm direction=horizontal<cr>')
vim.keymap.set('n', '<leader>tv', '<cmd>ToggleTerm direction=vertical<cr>')
vim.keymap.set('n', '<leader>tf', '<cmd>ToggleTerm direction=float<cr>')
vim.keymap.set('n', '<leader>tt', '<cmd>ToggleTerm direction=tab<cr>')
vim.keymap.set("n", "<leader>th", "<cmd>ToggleTerm direction=horizontal<cr>")
vim.keymap.set("n", "<leader>tv", "<cmd>ToggleTerm direction=vertical<cr>")
vim.keymap.set("n", "<leader>tf", "<cmd>ToggleTerm direction=float<cr>")
vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm direction=tab<cr>")
-- Aerial
vim.keymap.set('n', '<leader>aa', '<cmd>AerialToggle<cr>')
vim.keymap.set("n", "<leader>aa", "<cmd>AerialToggle<cr>")
-- Telescope
vim.keymap.set('n', '<leader>;', '<cmd>Telescope builtin<cr>')
vim.keymap.set('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
vim.keymap.set('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
vim.keymap.set('n', '<leader>fp', '<cmd>Telescope projects<cr>')
vim.keymap.set('n', '<leader>fa', '<cmd>Telescope aerial<cr>')
vim.keymap.set('n', '<leader>fl', '<cmd>Telescope lsp_document_symbols<cr>')
vim.keymap.set('n', '<leader>fe', '<cmd>Telescope diagnostics<cr>')
vim.keymap.set('n', '<leader>fs', '<cmd>Telescope treesitter<cr>')
vim.keymap.set('n', '<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
vim.keymap.set("n", "<leader>;", "<cmd>Telescope builtin<cr>")
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>")
vim.keymap.set("n", "<leader>fg", "<cmd>Telescope live_grep<cr>")
vim.keymap.set("n", "<leader>fp", "<cmd>Telescope projects<cr>")
vim.keymap.set("n", "<leader>fa", "<cmd>Telescope aerial<cr>")
vim.keymap.set("n", "<leader>fl", "<cmd>Telescope lsp_document_symbols<cr>")
vim.keymap.set("n", "<leader>fe", "<cmd>Telescope diagnostics<cr>")
vim.keymap.set("n", "<leader>fs", "<cmd>Telescope treesitter<cr>")
vim.keymap.set("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<cr>")
-- Nvim-tree
vim.keymap.set('n', '<leader>n', '<cmd>NvimTreeToggle<cr>')
vim.keymap.set("n", "<leader>n", "<cmd>NvimTreeToggle<cr>")
-- Trouble
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>')
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_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>xl', '<cmd>TroubleToggle loclist<cr>')
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>")
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_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>xl", "<cmd>TroubleToggle loclist<cr>")
-- Navigator
vim.keymap.set({'n', 't'}, '<A-h>', '<CMD>NavigatorLeft<CR>')
vim.keymap.set({'n', 't'}, '<A-l>', '<CMD>NavigatorRight<CR>')
vim.keymap.set({'n', 't'}, '<A-k>', '<CMD>NavigatorUp<CR>')
vim.keymap.set({'n', 't'}, '<A-j>', '<CMD>NavigatorDown<CR>')
vim.keymap.set({'n', 't'}, '<A-p>', '<CMD>NavigatorPrevious<CR>')
vim.keymap.set({ "n", "t" }, "<A-h>", "<CMD>NavigatorLeft<CR>")
vim.keymap.set({ "n", "t" }, "<A-l>", "<CMD>NavigatorRight<CR>")
vim.keymap.set({ "n", "t" }, "<A-k>", "<CMD>NavigatorUp<CR>")
vim.keymap.set({ "n", "t" }, "<A-j>", "<CMD>NavigatorDown<CR>")
vim.keymap.set({ "n", "t" }, "<A-p>", "<CMD>NavigatorPrevious<CR>")

View file

@ -1,17 +1,17 @@
vim.opt.title = true
vim.g.python3_host_prog = '/usr/bin/python3'
vim.g.python3_host_prog = "/usr/bin/python3"
vim.g.python_indent = {
open_paren = 'shiftwidth()',
nested_paren = 'shiftwidth()',
continue = 'shiftwidth()',
closed_paren_align_last_line = 'v:false',
open_paren = "shiftwidth()",
nested_paren = "shiftwidth()",
continue = "shiftwidth()",
closed_paren_align_last_line = "v:false",
}
vim.opt.termguicolors = true
vim.opt.mouse = "nv"
vim.opt.shiftwidth = 4
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.listchars = { trail = '.', tab = '>_' }
vim.opt.listchars = { trail = ".", tab = ">_" }
vim.opt.list = true
vim.opt.wrap = true
vim.opt.linebreak = true

View file

@ -5,153 +5,153 @@ vim.cmd([[
augroup end
]])
require('packer').startup {
function(use)
use 'wbthomason/packer.nvim'
use 'lewis6991/impatient.nvim'
use 'stevearc/dressing.nvim'
use {
"EdenEast/nightfox.nvim",
config = function ()
require 'config.nightfox'
end
}
use {
'nanozuki/tabby.nvim',
config = function ()
require 'config.tabby'
end
}
use {
'rcarriga/nvim-notify',
config = function()
require("notify").setup {
background_colour = "#282c34",
}
vim.notify = require("notify")
end
}
use {
'vigoux/notifier.nvim',
config = function ()
require('notifier')
end
}
use 'kyazdani42/nvim-web-devicons'
use 'nvim-lua/plenary.nvim'
use {
'neovim/nvim-lspconfig',
'https://github.com/nvim-lua/lsp-status.nvim.git',
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'f3fora/cmp-spell',
'petertriho/cmp-git',
'Dosx001/cmp-commit',
'kdheepak/cmp-latex-symbols',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets',
'windwp/nvim-autopairs',
'https://github.com/jose-elias-alvarez/null-ls.nvim',
}
use {
'nvim-treesitter/nvim-treesitter',
config = function()
require 'config.treesitter'
end
}
use {
"ThePrimeagen/refactoring.nvim",
requires = {
{"nvim-lua/plenary.nvim"},
{"nvim-treesitter/nvim-treesitter"}
},
config = function ()
require("refactoring").setup()
end
}
use {
'tpope/vim-fugitive',
}
use {
'https://github.com/lewis6991/gitsigns.nvim.git',
config = function()
require 'config.gitsigns'
end
}
use {
'feline-nvim/feline.nvim',
config = function ()
require 'config.feline'
end
}
use {
'kyazdani42/nvim-tree.lua',
config = function()
require 'config.nvim-tree'
end
}
use {
"ahmedkhalf/project.nvim",
config = function()
require 'config.project'
end
}
use {
'akinsho/toggleterm.nvim',
tag = 'v2.*',
config = function()
require 'config.toggleterm'
end
}
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'make'
}
use {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
requires = {
{ 'nvim-lua/plenary.nvim' }
},
config = function()
require 'config.telescope'
end
}
use {
'folke/trouble.nvim',
config = function()
require 'config.trouble'
end
}
use {
"lukas-reineke/indent-blankline.nvim",
config = function()
require('indent_blankline').setup {
show_current_context = true,
show_current_context_start = false,
}
end
}
use {
'numToStr/Navigator.nvim',
config = function()
require('Navigator').setup {
mux = 'auto'
}
end
}
end,
config = {
display = {
open_fn = function()
return require('packer.util').float({ border = 'single' })
end
},
}
}
require 'config.lsp'
require 'config.cmp'
require("packer").startup({
function(use)
use("wbthomason/packer.nvim")
use("lewis6991/impatient.nvim")
use("stevearc/dressing.nvim")
use({
"EdenEast/nightfox.nvim",
config = function()
require("config.nightfox")
end,
})
use({
"nanozuki/tabby.nvim",
config = function()
require("config.tabby")
end,
})
use({
"rcarriga/nvim-notify",
config = function()
require("notify").setup({
background_colour = "#282c34",
})
vim.notify = require("notify")
end,
})
use({
"vigoux/notifier.nvim",
config = function()
require("notifier")
end,
})
use("kyazdani42/nvim-web-devicons")
use("nvim-lua/plenary.nvim")
use({
"neovim/nvim-lspconfig",
"https://github.com/nvim-lua/lsp-status.nvim.git",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"f3fora/cmp-spell",
"petertriho/cmp-git",
"Dosx001/cmp-commit",
"kdheepak/cmp-latex-symbols",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"windwp/nvim-autopairs",
"https://github.com/jose-elias-alvarez/null-ls.nvim",
})
use({
"nvim-treesitter/nvim-treesitter",
config = function()
require("config.treesitter")
end,
})
use({
"ThePrimeagen/refactoring.nvim",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("refactoring").setup()
end,
})
use({
"tpope/vim-fugitive",
})
use({
"https://github.com/lewis6991/gitsigns.nvim.git",
config = function()
require("config.gitsigns")
end,
})
use({
"feline-nvim/feline.nvim",
config = function()
require("config.feline")
end,
})
use({
"kyazdani42/nvim-tree.lua",
config = function()
require("config.nvim-tree")
end,
})
use({
"ahmedkhalf/project.nvim",
config = function()
require("config.project")
end,
})
use({
"akinsho/toggleterm.nvim",
tag = "v2.*",
config = function()
require("config.toggleterm")
end,
})
use({
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
})
use({
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
requires = {
{ "nvim-lua/plenary.nvim" },
},
config = function()
require("config.telescope")
end,
})
use({
"folke/trouble.nvim",
config = function()
require("config.trouble")
end,
})
use({
"lukas-reineke/indent-blankline.nvim",
config = function()
require("indent_blankline").setup({
show_current_context = true,
show_current_context_start = false,
})
end,
})
use({
"numToStr/Navigator.nvim",
config = function()
require("Navigator").setup({
mux = "auto",
})
end,
})
end,
config = {
display = {
open_fn = function()
return require("packer.util").float({ border = "single" })
end,
},
},
})
require("config.lsp")
require("config.cmp")

View file

@ -1,6 +1,6 @@
-- TODO convert to lua
vim.cmd("let &t_ut=''") -- For kitty background colour support
vim.cmd [[
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
]]
]])

View file

@ -2,7 +2,7 @@ fzf
lazygit
lua-language-server
neovim
pyenv
prettier
python
python-black
python-isort
@ -13,6 +13,8 @@ python-pre-commit
python-pynvim
python-virtualenv
ripgrep
shfmt
stylua
tmux
tree-sitter
wezterm