Compare commits

..

1 commit

Author SHA1 Message Date
b5b528603d lock: use openssl instead of gpg 2025-03-07 20:57:18 +01:00
95 changed files with 1313 additions and 1212 deletions

1
.gitignore vendored
View file

@ -7,7 +7,6 @@ config.sh
config/containers
config/git/gitk
config/htop
config/iterm2
config/zsh/.zcompcache
config/zsh/.zcompdump

View file

@ -317,8 +317,8 @@ sub print_block {
$index = 4 if $index > 4;
$_
= ( $format eq "ascii" ) ? "${ascii[$index]} "
: ( $format eq "unicode" ) ? "\e[38;5;$colors[$index]m${unicode[$index]} \e[0m"
: "\e[38;5;$colors[$index]m \e[0m";
: ( $format eq "unicode" ) ? "${unicode[$index]} "
: "\e[38;5;$colors[$index]m\x{25fc} \e[0m";
print;
}

View file

@ -1,5 +0,0 @@
#!/bin/sh
#
# Detailed description of what I'm looking at.
#
exec git describe --always --tags --long --dirty

View file

@ -9,11 +9,7 @@ error() {
[ -n "$1" ] || error "input file missing"
[ -r "$1" ] || error "can't read input file"
# shellcheck disable=SC2016 # I don't want $(tty) to be expanded
printf '#!/bin/sh
GPG_TTY=$(tty)
export GPG_TTY
base64 -d <<EOF | gpg -d
openssl enc -d -aes256 -pbkdf2 -base64 <<EOF
%s
EOF
' "$(gpg -c --cipher-algo AES256 -o - -- "$1" | base64)"
EOF' "$(openssl enc -aes256 -pbkdf2 -base64 -in "$1")"

55
config/broot/conf.toml Normal file
View file

@ -0,0 +1,55 @@
###############################################################
# Configuration documentation is available at
# https://dystroy.org/broot
###############################################################
# Column order
cols_order = [
"permission",
"count",
"size",
"date",
"mark",
"git",
"branch",
"name",
]
# Max file size for content search
content_search_max_file_size = "10MB"
date_time_format = "%Y-%m-%d %R"
default_flags = "--sort-by-type --no-trim-root"
# Show NerdFont icons.
# icon_theme = "nerdfont"
imports = [
"verbs.toml",
{ luma = ["dark", "unknown"], file = "skins/dark.toml" },
{ luma = "light", file = "skins/light.toml" },
]
# Whether to mark the selected line with a triangle
show_selection_mark = true
# Special paths
# =============
# "list":"never" on a dir prevents broot from looking at its
# children when searching, unless the dir is the selected root.
# "sum":"never" on a dir prevents broot from looking at its
# children when computing the total size and count of files.
# "show":"always" makes a file visible even if its name
# starts with a dot.
# "list":"always" may be useful on a link to a directory
# (they're otherwise not entered by broot unless selected)
[special_paths."/media"]
list = "never"
sum = "never"
[special_paths."~/.config"]
show = "always"
# Quit if there is nothing else to escape.
quit_on_last_cancel = true

View file

@ -0,0 +1,4 @@
This file tells broot you refused the installation of the companion shell function.
If you want to install it run
broot -- install

View file

@ -0,0 +1,96 @@
################################################################################
# A skin for a terminal with a dark background
# Created by Fernando Schauenburg <dev@schauenburg.me>
#
# Example colors from tokyonight:
#
# NAME RGB Index
# black rgb(21, 22, 30) ansi(0)
# br_black rgb(65, 72, 104) ansi(8)
# red rgb(247, 118, 142) ansi(1)
# green rgb(158, 206, 106) ansi(2)
# yellow rgb(224, 175, 104) ansi(3)
# blue rgb(122, 162, 247) ansi(4)
# magenta rgb(187, 154, 247) ansi(5)
# cyan rgb(125, 207, 255) ansi(6)
# white rgb(169, 177, 214) ansi(7)
# br_white rgb(192, 202, 245) ansi(15)
#
# Doc at https://dystroy.org/broot/skins/
################################################################################
[skin]
default = "ansi(7)"
input = "ansi(7)"
selected_line = "none ansi(0)"
tree = "ansi(8)"
parent = "none"
perm__ = "ansi(8)"
perm_r = "ansi(3)"
perm_w = "ansi(1)"
perm_x = "ansi(2)"
count = "ansi(1)"
owner = "ansi(3)"
group = "ansi(3)"
dates = "ansi(4)"
file = "ansi(15)"
directory = "ansi(4) none"
exe = "ansi(2) none"
link = "ansi(6)"
pruning = "ansi(8) none Italic"
content_extract = "ansi(244) none Italic"
char_match = "ansi(3) ansi(0) Bold Italic"
preview_match = "ansi(3) ansi(0) Bold Italic"
content_match = "ansi(3) ansi(0) Bold Italic"
git_branch = "ansi(4) none Bold"
git_insertions = "ansi(2) none Bold"
git_deletions = "ansi(1) none Bold"
git_status_current = "ansi(8)"
git_status_modified = "ansi(4)"
git_status_new = "ansi(2) none Bold"
git_status_ignored = "ansi(8)"
git_status_conflicted = "ansi(1)"
git_status_other = "ansi(7)"
help_paragraph = "ansi(7)"
help_headers = "ansi(3) none Bold"
help_bold = "ansi(4) none Bold"
help_italic = "ansi(6) none Italic"
help_code = "ansi(3) none Bold"
help_table_border = "ansi(8)"
scrollbar_track = "ansi(8)"
scrollbar_thumb = "ansi(7)"
flag_label = "ansi(4)"
flag_value = "ansi(3) none Bold"
staging_area_title = "ansi(3) none Bold"
preview_title = "ansi(0) ansi(3) Bold"
preview = "ansi(7)"
preview_line_number = "ansi(8)"
# sparse = "ansi(1)"
status_normal = "none ansi(0)"
status_italic = "ansi(6) Italic"
status_bold = "ansi(4) Bold"
# status_ellipsis = "ansi(3)"
status_error = "ansi(1) ansi(0)"
# status_job = "ansi(3)"
status_code = "ansi(3)"
mode_command_mark = "ansi(0) ansi(3) Bold"
hex_null = "ansi(7)"
hex_ascii_graphic = "ansi(2)"
hex_ascii_whitespace = "ansi(2) ansi(0) Italic"
hex_ascii_other = "ansi(2) none Bold"
hex_non_ascii = "ansi(1) Bold"
file_error = "ansi(1) none"
purpose_normal = "red"
# purpose_italic = "ansi(1) none Italic"
# purpose_bold = "ansi(1) none Bold"
# purpose_ellipsis = "none"
good_to_bad_0 = "rgb(166, 227, 161)"
good_to_bad_1 = "rgb(148, 226, 213)"
good_to_bad_2 = "rgb(137, 220, 235)"
good_to_bad_3 = "rgb(116, 199, 236)"
good_to_bad_4 = "rgb(137, 180, 250)"
good_to_bad_5 = "rgb(180, 190, 254)"
good_to_bad_6 = "rgb(203, 166, 247)"
good_to_bad_7 = "rgb(250, 179, 135)"
good_to_bad_8 = "rgb(235, 160, 172)"
good_to_bad_9 = "rgb(243, 139, 168)"

View file

@ -0,0 +1,96 @@
################################################################################
# A skin for a terminal with a dark background
# Created by Fernando Schauenburg <dev@schauenburg.me>
#
# Example colors from tokyonight:
#
# NAME RGB Index
# black rgb(192, 202, 245) ansi(0)
# br_black rgb(169, 177, 214) ansi(8)
# red rgb(247, 118, 142) ansi(1)
# green rgb(158, 206, 106) ansi(2)
# yellow rgb(224, 175, 104) ansi(3)
# blue rgb(122, 162, 247) ansi(4)
# magenta rgb(187, 154, 247) ansi(5)
# cyan rgb(125, 207, 255) ansi(6)
# white rgb(65, 72, 104) ansi(7)
# br_white rgb(21, 22, 30) ansi(15)
#
# Doc at https://dystroy.org/broot/skins/
################################################################################
[skin]
default = "ansi(8)"
input = "ansi(8)"
selected_line = "none ansi(15)"
tree = "ansi(7)"
parent = "none"
perm__ = "ansi(7)"
perm_r = "ansi(3)"
perm_w = "ansi(1)"
perm_x = "ansi(2)"
count = "ansi(1)"
owner = "ansi(3)"
group = "ansi(3)"
dates = "ansi(4)"
file = "ansi(0)"
directory = "ansi(4) none Bold"
exe = "ansi(2) none Bold"
link = "ansi(6)"
pruning = "ansi(7) none Italic"
content_extract = "ansi(244) none Italic"
char_match = "ansi(3) ansi(15) Bold Italic"
preview_match = "ansi(3) ansi(15) Bold Italic"
content_match = "ansi(3) ansi(15) Bold Italic"
git_branch = "ansi(4) none Bold"
git_insertions = "ansi(2) none Bold"
git_deletions = "ansi(1) none Bold"
git_status_current = "ansi(7)"
git_status_modified = "ansi(4)"
git_status_new = "ansi(2) none Bold"
git_status_ignored = "ansi(7)"
git_status_conflicted = "ansi(1)"
git_status_other = "ansi(8)"
help_paragraph = "ansi(8)"
help_headers = "ansi(3) none Bold"
help_bold = "ansi(4) none Bold"
help_italic = "ansi(6) none Italic"
help_code = "ansi(3) none Bold"
help_table_border = "ansi(7)"
scrollbar_track = "ansi(7)"
scrollbar_thumb = "ansi(8)"
flag_label = "ansi(4)"
flag_value = "ansi(3) none Bold"
staging_area_title = "ansi(3) none Bold"
preview_title = "ansi(15) ansi(3) Bold"
preview = "ansi(8)"
preview_line_number = "ansi(7)"
# sparse = "ansi(1)"
status_normal = "none ansi(15)"
status_italic = "ansi(6) Italic"
status_bold = "ansi(4) Bold"
# status_ellipsis = "ansi(3)"
status_error = "ansi(1) ansi(15)"
# status_job = "ansi(3)"
status_code = "ansi(3)"
mode_command_mark = "ansi(15) ansi(3) Bold"
hex_null = "ansi(8)"
hex_ascii_graphic = "ansi(2)"
hex_ascii_whitespace = "ansi(2) ansi(15) Italic"
hex_ascii_other = "ansi(2) none Bold"
hex_non_ascii = "ansi(1) Bold"
file_error = "ansi(1) none"
purpose_normal = "red"
# purpose_italic = "ansi(1) none Italic"
# purpose_bold = "ansi(1) none Bold"
# purpose_ellipsis = "none"
good_to_bad_0 = "rgb(166, 227, 161)"
good_to_bad_1 = "rgb(148, 226, 213)"
good_to_bad_2 = "rgb(137, 220, 235)"
good_to_bad_3 = "rgb(116, 199, 236)"
good_to_bad_4 = "rgb(137, 180, 250)"
good_to_bad_5 = "rgb(180, 190, 254)"
good_to_bad_6 = "rgb(203, 166, 247)"
good_to_bad_7 = "rgb(250, 179, 135)"
good_to_bad_8 = "rgb(235, 160, 172)"
good_to_bad_9 = "rgb(243, 139, 168)"

78
config/broot/verbs.toml Normal file
View file

@ -0,0 +1,78 @@
###############################################################
# This file contains the verb definitions for broot
#
# Documentation at https://dystroy.org/broot/verbs/
###############################################################
[[verbs]]
invocation = "edit"
shortcut = "e"
key = "enter"
apply_to = "text_file"
execution = "nvim +{line} {file}"
leave_broot = false
[[verbs]]
name = "touch"
invocation = "touch {new_file}"
execution = "touch {directory}/{new_file}"
leave_broot = false
[[verbs]]
invocation = "create {subpath}"
execution = "$EDITOR {directory}/{subpath}"
leave_broot = false
[[verbs]]
invocation = "git_diff"
shortcut = "gd"
leave_broot = false
execution = "git difftool -y {file}"
[[verbs]]
invocation = "backup {version}"
key = "ctrl-b"
leave_broot = false
auto_exec = false
execution = "cp -r {file} {file}.{version}"
# execution = "cp -r {file} {parent}/{file-stem}{version}{file-dot-extension}"
[[verbs]]
invocation = "terminal"
key = "ctrl-t"
execution = "$SHELL"
set_working_dir = true
leave_broot = false
[[verbs]]
invocation = "git_root"
shortcut = "gtr"
execution = ":focus {git-root}"
[[verbs]]
key = "ctrl-c"
execution = ":escape"
[[verbs]]
key = "ctrl-h"
execution = ":panel_left_no_open"
[[verbs]]
key = "ctrl-l"
execution = ":panel_right"
[[verbs]]
key = "ctrl-k"
execution = ":line_up"
[[verbs]]
key = "ctrl-j"
execution = ":line_down"
[[verbs]]
key = "ctrl-u"
execution = ":page_up"
[[verbs]]
key = "ctrl-d"
execution = ":page_down"

View file

@ -15,7 +15,6 @@
la = l --all
lna = ln --all
lla = ll --all
lw = !watch -c -n 1 git log --color=always --graph --pretty=basic --all
s = status --short
ss = status

View file

@ -1,16 +1,11 @@
# Gruvbox Dark
ForegroundColour = 235, 219, 178
# BackgroundColour = 29, 32, 33
# BackgroundColour = 23, 26, 27
BackgroundColour = 19, 21, 22
CursorColour = 157, 0, 6
# CursorColour = 204, 36, 29
IMECursorColour = 157, 0, 6
# IMECursorColour = 204, 36, 29
BackgroundColour = 24, 25, 26
CursorColour = 204, 36, 29
IMECursorColour = 204, 36, 29
Black = 40, 40, 40
Red = 204, 36, 29

View file

@ -1 +1 @@
require("util.options").set_gitcommit_buffer_options()
require("fschauen.util.options").set_gitcommit_buffer_options()

View file

@ -1,27 +0,0 @@
vim.bo.commentstring = "// %s"
local insert_include_guards = function(bufnr)
bufnr = bufnr or 0
-- foo.h -> FOO_H_
local guard = string.gsub(string.upper(vim.fn.expand("%:t")), "%.", "_") .. "_"
vim.api.nvim_buf_set_lines(bufnr, 0, 0, true, {
string.format("#ifndef %s", guard),
string.format("#define %s", guard),
"",
})
local last_lineno = vim.api.nvim_buf_line_count(bufnr)
vim.api.nvim_buf_set_lines(bufnr, last_lineno, last_lineno, true, {
"",
string.format("#endif // %s", guard),
})
end
vim.keymap.set(
"n",
"<localleader>ig",
insert_include_guards,
{ desc = "Add include guards", buffer = true, silent = true }
)

View file

@ -1 +1 @@
require("util.options").set_gitcommit_buffer_options()
require("fschauen.util.options").set_gitcommit_buffer_options()

View file

@ -1,6 +1,6 @@
vim.bo.tabstop = 2
local lua = require("util.lua")
local lua = require("fschauen.util.lua")
local map = vim.keymap.set
local opts = function(desc) return { desc = desc, buffer = true, silent = true } end

View file

@ -1,4 +0,0 @@
---@type vim.lsp.Config
return {
cmd = { "clangd", "--header-insertion=never" },
}

View file

@ -1,24 +0,0 @@
---@type vim.lsp.Config
return {
settings = {
Lua = {
-- I'm using lua only inside neovim, so the runtime is LuaJIT.
runtime = { version = "LuaJIT" },
-- Get the language server to recognize the `vim` global.
diagnostics = { globals = { "vim" } },
-- Make the server aware of Neovim runtime files.
workspace = {
library = { vim.env.VIMRUNTIME },
-- Alternatively, pull in all of 'runtimepath'.
-- But see: https://github.com/neovim/nvim-lspconfig/issues/3189
-- library = { vim.api.nvim_get_runtime_file("", true) }
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
}

View file

@ -1,18 +0,0 @@
---@type vim.lsp.Config
return {
-- Use .editoconfig for code style, naming convention and analyzer settings.
enable_editorconfig_support = true,
-- Show unimported types and add`using` directives.
enable_import_completion = true,
-- Enable roslyn analyzers, code fixes, and rulesets.
enable_roslyn_analyzers = true,
-- Don't include preview versions of the .NET SDK.
sdk_include_prereleases = false,
handlers = {
["textDocument/definition"] = require("omnisharp_extended").handler,
},
}

View file

@ -1,3 +1,3 @@
if vim.loader then vim.loader.enable() end
require("config")
require("fschauen")

View file

@ -1,61 +1,62 @@
{
"LuaSnip": { "branch": "master", "commit": "eda5be8f0ce9816278671f0b578cdbb8b762c701" },
"blame.nvim": { "branch": "main", "commit": "b87b8c820e4cec06fbbd2f946b7b35c45906ee0c" },
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"blame.nvim": { "branch": "main", "commit": "dedbcdce857f708c63f261287ac7491a893912d0" },
"catppuccin": { "branch": "main", "commit": "9703f227bfab20d04bcee62d2f08f1795723b4ae" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"dial.nvim": { "branch": "master", "commit": "2c7e2750372918f072a20f3cf754d845e143d7c9" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"git-messenger.vim": { "branch": "master", "commit": "fd124457378a295a5d1036af4954b35d6b807385" },
"formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" },
"git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"kanagawa.nvim": { "branch": "master", "commit": "ab41956c4559c3eb21e713fcdf54cda1cb6d5f40" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
"neogit": { "branch": "master", "commit": "e3c148905c334c886453df1490360ebb1a2ba2ed" },
"nerdy.nvim": { "branch": "main", "commit": "826a74b0e2d86548190ac4575cccd8d5b159c0a1" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"neogen": { "branch": "main", "commit": "4a2f68d3eae0018b04132f1d4590e51484043354" },
"neogit": { "branch": "master", "commit": "536b4cfc009fc6d8bd771f010f04d48204533fae" },
"nerdy.nvim": { "branch": "main", "commit": "7c9a4ea4a9ca7063e86dbcf7ce0f233cb59bdc10" },
"nginx.vim": { "branch": "master", "commit": "cffaec54f0c7f9518de053634413a20e90eac825" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" },
"nvim-lspconfig": { "branch": "master", "commit": "6bba673aa8993eceec233be17b42ddfb9540794b" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" },
"nvim-lspconfig": { "branch": "master", "commit": "1bc83418927003552505ec66fa5d6cffae953f6a" },
"nvim-luaref": { "branch": "main", "commit": "9cd3ed50d5752ffd56d88dd9e395ddd3dc2c7127" },
"nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" },
"nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "ec1a2431f8872f650a85ed71c24f0715df2e49c2" },
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
"nvim-tree.lua": { "branch": "master", "commit": "8cbb1db8e90b62fc56f379992e622e9f919792ce" },
"nvim-treesitter": { "branch": "master", "commit": "b444afa1dacd3d031c0ffe4763671d89afda5ddb" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dd0b2036c3a27cb6e6486f8bd24188c6ca43af0b" },
"nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "4be2e8689067494ed7e5a4f1221adc31d1a07783" },
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
"plantuml-previewer.vim": { "branch": "master", "commit": "368a1f331c1ff29f6a3ee76facfca39a7f374b13" },
"plantuml-syntax": { "branch": "master", "commit": "9d4900aa16674bf5bb8296a72b975317d573b547" },
"plantuml-previewer.vim": { "branch": "master", "commit": "1dd4d0f2b09cd80a217f76d82f93830dbbe689b3" },
"plantuml-syntax": { "branch": "master", "commit": "1592944444513c208ab5a087397ba987932af750" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"swift.vim": { "branch": "master", "commit": "c76b52c68b633ad397ddab761c47efc7b5c1a6b9" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "7bf55ed0ff5be182ad3301cff266581fc1c56cce" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"swift.vim": { "branch": "master", "commit": "bb62135c4364c84b56499f4b54e1a6b8eca72eec" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "6dd6522bc1a4cbe5883eb0272f5cc7a54ae3858b" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "236083884cfe6c874e03e6cb4e7cb08809c1333c" },
"text-case.nvim": { "branch": "main", "commit": "5d85b7495c3cf8e842e4d2528edc68e6fe7c92c8" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"undotree": { "branch": "master", "commit": "7df3be7a261ea31b528aa442b494fcb458f3d968" },
"vim-applescript": { "branch": "master", "commit": "a39af8fc7e4caf581366e2917d558f6232e4db36" },
"vim-better-whitespace": { "branch": "master", "commit": "de99b55a6fe8c96a69f9376f16b1d5d627a56e81" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" },
"virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }
}
"vim-better-whitespace": { "branch": "master", "commit": "029f35c783f1b504f9be086b9ea757a36059c846" },
"vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" },
"vim-fugitive": { "branch": "master", "commit": "e7bf502a6ae492f42a91d231864e25630286319b" },
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }
}

View file

@ -1,106 +0,0 @@
local M = {}
-- stylua: ignore start
M.setup = function()
-- better navigation for wrapped lines
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
-- maintain cursor position when joining lines
vim.keymap.set("n", "J", "mzJ`z")
-- retain selection when making changes in visual mode
vim.keymap.set("v", "<c-a>", "<c-a>gv")
vim.keymap.set("v", "<c-x>", "<c-x>gv")
vim.keymap.set("v", "g<c-a>", "g<c-a>gv")
vim.keymap.set("v", "g<c-x>", "g<c-x>gv")
vim.keymap.set("v", ">", "><cr>gv")
vim.keymap.set("v", "<", "<<cr>gv")
-- place destination of important movements in the center of the screen
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("n", "*", "*zzzv")
vim.keymap.set("n", "#", "#zzzv")
vim.keymap.set("n", "g*", "g*zzzv")
vim.keymap.set("n", "g#", "g#zzzv")
vim.keymap.set("n", "<c-d>", "<c-d>zzzv")
vim.keymap.set("n", "<c-u>", "<c-u>zzzv")
-- easier window navigation
vim.keymap.set("n", "<c-j>", "<c-w>j")
vim.keymap.set("n", "<c-k>", "<c-w>k")
vim.keymap.set("n", "<c-h>", "<c-w>h")
vim.keymap.set("n", "<c-l>", "<c-w>l")
-- disable highlight until next search
vim.keymap.set("n", "<leader>h", "<cmd>nohlsearch<cr>")
local window = require("util.window")
-- window resizing
vim.keymap.set("n", "<s-Up>", window.resize_up(2), { desc = "Resize window upward" })
vim.keymap.set("n", "<s-Down>", window.resize_down(2), { desc = "Resize window downward" })
vim.keymap.set("n", "<s-Left>", window.resize_left(2), { desc = "Resize window leftward" })
vim.keymap.set("n", "<s-Right>", window.resize_right(2), { desc = "Resize window rightward" })
-- easy tab navigation
vim.keymap.set("n", "<Right>", "<cmd>tabnext<cr>")
vim.keymap.set("n", "<Left>", "<cmd>tabprevious<cr>")
-- move lines up and down
vim.keymap.set("n", "<c-a-j>", [[:move .+1<cr>==]])
vim.keymap.set("n", "<c-a-k>", [[:move .-2<cr>==]])
vim.keymap.set("v", "<c-a-j>", [[:move '>+1<cr>gv=gv]])
vim.keymap.set("v", "<c-a-k>", [[:move '<-2<cr>gv=gv]])
vim.keymap.set("i", "<c-a-j>", [[<esc>:move .+1<cr>==gi]])
vim.keymap.set("i", "<c-a-k>", [[<esc>:move .-2<cr>==gi]])
-- move to begin/end of line in insert mode
vim.keymap.set("i", "<c-a>", "<c-o>^")
vim.keymap.set("i", "<c-e>", "<c-o>$")
-- move to begin of line in command mode (<c-e> moves to end by default)
vim.keymap.set("c", "<c-a>", "<c-b>")
-- more convenient way of entering normal mode from terminal mode
vim.keymap.set("t", [[<c-\><c-\>]], [[<c-\><c-n>]])
-- recall older/recent command-line from history
vim.keymap.set("c", "<c-j>", "<down>")
vim.keymap.set("c", "<c-k>", "<up>")
-- trigger InsertLeave when leaving Insert mode with ctrl-c (see :help i_CTRL-C)
vim.keymap.set("i", "<c-c>", "<esc>")
-- quickly change background
vim.keymap.set("n", "<leader>bg", [[<cmd>let &background = &background ==? "light" ? "dark" : "light"<cr>]])
-- don't loose the original yanked contents when pasting in visual mode
vim.keymap.set("x", "<leader>p", [["_dP]])
local diagnostic = require("config.diagnostic")
local ui = require("util.icons").ui
-- navigate diagnostics
vim.keymap.set("n", "<leader>dd", diagnostic.toggle, { desc = ui.Diagnostic.." [d]iagnostic enable/[d]isable" })
vim.keymap.set("n", "<leader>do", diagnostic.open_float, { desc = ui.Diagnostic.." [d]iagnostic [o]pen" })
vim.keymap.set("n", "<leader>dh", diagnostic.hide, { desc = ui.Diagnostic.." [d]iagnostic [h]ide" })
vim.keymap.set("n", "<leader>ds", diagnostic.set_severity, { desc = ui.Diagnostic.." [d]iagnostic [s]everity" })
-- toggle quickfix and loclist
vim.keymap.set("n", "<leader>q", window.toggle_quickfix, { desc = ui.Toggle.." toggle quickfix" })
vim.keymap.set("n", "<localleader>q", window.toggle_loclist, { desc = ui.Toggle.." toggle loclist" })
local options = require("util.options")
-- toggle options
vim.keymap.set("n", "<leader>sn", options.toggle_number, { desc = ui.Toggle.." toggle 'number'" })
vim.keymap.set("n", "<leader>sr", options.toggle_relativenumber, { desc = ui.Toggle.." toggle 'relativenumber'" })
vim.keymap.set("n", "<leader>sl", options.toggle_list, { desc = ui.Toggle.." toggle 'list'" })
vim.keymap.set("n", "<leader>sw", options.toggle_wrap, { desc = ui.Toggle.." toggle 'wrap'" })
vim.keymap.set("n", "<leader>ss", options.toggle_spell, { desc = ui.Toggle.." toggle 'spell'" })
end
-- stylua: ignore end
return M

View file

@ -1,76 +0,0 @@
local toggle_inlay_hints = function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
local map_local = function(mode, lhs, rhs, opts)
opts = vim.tbl_deep_extend("force", opts or {}, { buffer = 0 })
vim.keymap.set(mode, lhs, rhs, opts)
end
local lsp_on_attach = function(args)
-- stylua: ignore start
map_local("n", "<leader>sh", toggle_inlay_hints, { desc = "LSP: toggle inlay hints" } )
map_local("n", "<localleader>c", vim.lsp.buf.code_action, { desc = "LSP: code action" } )
map_local("n", "<localleader>f", vim.lsp.buf.format, { desc = "LSP: format" } )
map_local("n", "gd", vim.lsp.buf.definition, { desc = "LSP: go to definition" } )
map_local("n", "gD", vim.lsp.buf.declaration, { desc = "LSP: go to declaration" } )
map_local("n", "gi", vim.lsp.buf.implementation, { desc = "LSP: go to implementation" } )
map_local("n", "grr", vim.lsp.buf.rename, { desc = "LSP: rename" } )
map_local("n", "gt", vim.lsp.buf.type_definition, { desc = "LSP: go to type definition" } )
map_local("n", "gs", vim.lsp.buf.signature_help, { desc = "LSP: show signature help" } )
map_local("i", "<c-s>", vim.lsp.buf.signature_help, { desc = "LSP: show signature help" } )
map_local("n", "K", vim.lsp.buf.hover, { desc = "LSP: display hover information" } )
-- stylua: ignore end
-- Opt out of semantic highlighting because it has been causing issues
-- https://github.com/neovim/nvim-lspconfig/issues/2542#issuecomment-1547019213
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.server_capabilities then
client.server_capabilities.semanticTokensProvider = nil
end
end
local make_lsp_builtins_use_rounded_border = function()
local patch = function(name)
local builtin = vim.lsp.buf[name]
vim.lsp.buf[name] = function(opts)
builtin(vim.tbl_deep_extend("force", opts or {}, { border = "rounded" }))
end
end
patch("signature_help")
patch("hover")
end
return {
"neovim/nvim-lspconfig",
dependencies = {
"Hoffs/omnisharp-extended-lsp.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
make_lsp_builtins_use_rounded_border()
local capabilities = (function()
local cmp_nvim_lsp = vim.F.npcall(require, "cmp_nvim_lsp")
if cmp_nvim_lsp then
return cmp_nvim_lsp.default_capabilities()
else
return vim.lsp.protocol.make_client_capabilities()
end
end)()
vim.lsp.config("*", { capabilities = capabilities })
vim.lsp.enable("clangd")
vim.lsp.enable("cmake")
vim.lsp.enable("lua_ls")
vim.lsp.enable("omnisharp")
vim.lsp.enable("pyright")
vim.api.nvim_create_autocmd("LspAttach", { callback = lsp_on_attach })
end,
}

View file

@ -1,98 +0,0 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
opts = function()
local icons = require("util.icons")
local colored_when_focused = require("util.lualine").colored_when_focused
local indicator = require("util.lualine").indicator
local window = require("util.window")
local orange = "#d65d0e"
local is_diagnostics_enabled = function(bufnr)
return vim.diagnostic.is_enabled { bufnr = bufnr or 0 }
end
--
-- Components
--
local autoformat = indicator {
icon = icons.ui.Format,
cond = require("util.autoformat").is_enabled,
}
local branch = {
"branch",
icon = icons.git.Branch,
cond = window.is_medium,
}
local diagnostics = {
colored_when_focused("diagnostics"),
cond = is_diagnostics_enabled,
}
local diag_status = indicator {
icon = icons.ui.Diagnostic,
cond = is_diagnostics_enabled,
}
local fileformat = {
"fileformat",
cond = window.is_medium,
}
local filename = "custom.filename"
local filetype = {
colored_when_focused("filetype"),
cond = window.is_medium,
}
local mode = "custom.mode"
local searchcount = "custom.searchcount"
local spell = indicator {
icon = icons.ui.SpellCheck,
cond = function() return vim.o.spell end,
}
local status = {
colored_when_focused("custom.status"),
color = { fg = orange },
padding = 0,
}
local whitespace = {
colored_when_focused("custom.whitespace"),
cond = window.is_wide,
}
local wrap = indicator {
icon = icons.ui.TextWrap,
cond = function() return vim.o.wrap end,
}
--
-- Sections
--
local sections = {
lualine_a = { mode },
lualine_b = { branch },
lualine_c = { filename, status },
lualine_x = { diagnostics, searchcount, whitespace, filetype },
lualine_y = { diag_status, spell, wrap, autoformat, fileformat, "progress" },
lualine_z = { "location" },
}
return {
options = {
icons_enabled = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = sections,
inactive_sections = sections,
extensions = {
"fugitive",
"quickfix",
"nvim-tree",
"lazy",
"man",
"trouble",
},
}
end,
}

View file

@ -1,22 +0,0 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
event = { "BufReadPre", "BufNewFile" },
config = function()
local icons = require("util.icons")
require("mason").setup {
ui = {
border = "rounded",
icons = {
package_installed = icons.git.file.Staged,
package_pending = icons.git.file.Unstaged,
package_uninstalled = icons.git.file.Deleted,
},
},
}
end,
}

View file

@ -1,16 +0,0 @@
local keymap = require("config.plugins.telescope").keymap
return {
"2kabhishek/nerdy.nvim",
cmd = "Nerdy",
dependencies = {
"stevearc/dressing.nvim",
"nvim-telescope/telescope.nvim",
},
keys = {
keymap { "i", "<cmd>Nerdy<cr>", desc = "Nerd [i]cons" },
},
}

View file

@ -1,63 +0,0 @@
return {
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "Oil",
lazy = false,
keys = {
{ "-", "<cmd>Oil<cr>", desc = "Open Oil" },
},
config = function()
require("oil").setup {
columns = {
"icon",
"permissions",
"size",
"mtime",
},
keymaps = {
["<c-s>"] = {
"actions.select",
opts = {
horizontal = true,
split = "belowright",
},
},
["<c-b>"] = { -- Not using <c-v> so that I can use Visual Block mode.
"actions.select",
opts = {
vertical = true,
split = "belowright",
},
},
["<c-r>"] = "actions.refresh",
-- Remove default keymaps that I use for navigation.
-- NOTE: the C must be capitalized (bug in Oil)
["<C-h>"] = false, -- use <c-s> intead
["<C-l>"] = false, -- use <c-r> instead
["<leader>:"] = {
"actions.open_cmdline",
opts = {
shorten_path = true,
},
desc = "Open command line with current entry as an argument",
},
["q"] = "actions.close",
},
view_options = {
show_hidden = true,
},
}
end,
}

View file

@ -1,16 +0,0 @@
local keymap = require("config.plugins.telescope").keymap
return {
"nvim-telescope/telescope-file-browser.nvim",
dependencies = "nvim-telescope/telescope.nvim",
keys = {
keymap {
"B",
"<cmd>Telescope file_browser theme=ivy<cr>",
desc = "file [B]rowser",
},
},
config = function() require("config.plugins.telescope").load_extension("file_browser") end,
}

View file

@ -1,216 +0,0 @@
local ui = require("util.icons").ui
local builtin = function(name, opts)
return function(title)
return function()
local picker = require("telescope.builtin")[name]
picker(vim.tbl_extend("force", opts or {}, {
prompt_title = title,
}))
end
end
end
local pickers = setmetatable({
all_files = builtin("find_files", {
hidden = true,
no_ignore = true,
no_ignore_parent = true,
}),
document_diagnostics = builtin("diagnostics", { bufnr = 0 }),
workspace_diagnostics = builtin("diagnostics"),
dotfiles = builtin("find_files", {
cwd = "~/.dotfiles",
hidden = true,
}),
plugins = builtin("find_files", {
cwd = vim.fn.stdpath("data") .. "/lazy",
}),
selection = function(title)
return function()
local text = require("util").get_selected_text()
return require("telescope.builtin").grep_string {
prompt_title = string.format(title .. ": %s ", text),
search = text,
}
end
end,
}, {
-- Fall back to telescope's built-in pickers if a custom one is not defined
-- above, but make sure to keep the title we defined.
__index = function(_, key) return builtin(key) end,
})
---@class LazyKeysSpec
---@field desc string
---Create consistent key maps with the same prefix and description style.
---@param spec LazyKeysSpec lazy.nvim key spec to modify
---@return LazyKeysSpec modified key spec with prefix and description
local keymap = function(spec)
vim.validate("Telescope key spec", spec, "table")
vim.validate("Telescope key lhs", spec[1], "string")
vim.validate("Telescope key rhs", spec[2], { "string", "function" })
vim.validate("Telescope key description", spec.desc, "string")
return vim.tbl_extend("force", spec, {
"<leader>f" .. spec[1], -- lhs
spec[2], -- rhs
desc = ui.Telescope .. " Telescope " .. spec.desc,
})
end
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release "
.. "&& cmake --build build --config Release "
.. "&& cmake --install build --prefix build",
},
cmd = "Telescope",
keys = vim
.iter({
-- stylua: ignore start
{ "a", pickers.autocommands " Autocommands" , desc = "[a]utocommands" },
{ "b", pickers.buffers " Buffers" , desc = "[b]uffers" },
--"B" used in telescope-file-browser
{ "c", pickers.colorscheme " Colorschemes" , desc = "[c]olorschemes" },
{ "C", pickers.commands " Commands" , desc = "[C]ommands" },
{ "d", pickers.document_diagnostics "󰀪 Document Diagnostics" , desc = "document [d]iagnostics" },
{ "D", pickers.workspace_diagnostics "󰀪 Workspace Diagnostics", desc = "workspace [d]iagnostics" },
--"e"
{ "f", pickers.find_files " Files" , desc = "[f]ind files" },
{ "F", pickers.all_files " ALL files" , desc = "all [F]iles" },
{ "gr", pickers.live_grep " Live grep" , desc = "Live [gr]ep" },
{ "gf", pickers.git_files " Git files" , desc = "[g]it [f]iles" },
{ "gc", pickers.git_commits " Commits" , desc = "[g]it [c]ommits" },
{ "h", pickers.current_buffer_fuzzy_find " Current buffer" , desc = "[h]ere (currenf buffer)" },
{ "H", pickers.highlights "󰌶 Highlights" , desc = "[H]ighlights" },
--"i" used in nerdy
{ "j", pickers.jumplist " Jumplist" , desc = "[j]umplist" },
{ "k", pickers.keymaps " Keymaps" , desc = "[k]eymaps" },
{ "K", pickers.help_tags " Help tags" , desc = "[K] help/documentation" },
{ "l", pickers.loclist " Location list" , desc = "[l]ocation List" },
{ "m", pickers.man_pages " Man pages" , desc = "[m]an pages" },
--"n" used in vim-notify
{ "o", pickers.vim_options " Vim options" , desc = "[o]ptions" },
{ "p", pickers.plugins " Installed Plugins" , desc = "[p]lugins" },
{ "q", pickers.quickfix " Quickfix" , desc = "[q]uickfix" },
{ "r", pickers.lsp_references " References" , desc = "[r]eferences" },
{ "R", pickers.registers "󱓥 Registers" , desc = "[R]registers" },
{ "s", pickers.lsp_document_symbols "󰫧 Document Symbols " , desc = "LSP document [s]ymbols" },
{ "S", pickers.lsp_workspace_symbols "󱄑 Workspace Symbols " , desc = "LSP workspace [S]ymbols" },
--"t" used in todo_comments
{ "T", pickers.treesitter " Treesitter symbols" , desc = "[T]reesitter Symbols" },
--"u"
--"v"
{ "w", pickers.selection " Grep" , desc = "[w]word under cursor" },
{ "w", pickers.selection " Grep", mode = "v" , desc = "[w]ord(s) selected" },
--"x"
--"y"
{ "z", pickers.spell_suggest "󰓆 Spelling suggestions" , desc = "[z] spell suggestions" },
{ ".", pickers.dotfiles " Dotfiles" , desc = "[.]dotfiles" },
{ ":", pickers.command_history " Command history" , desc = "[:]command history" },
{ "/", pickers.search_history " Search history" , desc = "[/]search history" },
{ " ", pickers.resume "󰐎 Resume" , desc = "Resume " },
-- stylua: ignore end
})
:map(keymap)
:totable(),
-- Export this function so we can use in other plugins.
keymap = keymap,
opts = function()
local actions = require("telescope.actions")
local layout = require("telescope.actions.layout")
local state = require("telescope.actions.state")
local clear_prompt = function(prompt_bufnr)
state.get_current_picker(prompt_bufnr):reset_prompt()
end
local mappings = {
["<c-y>"] = layout.cycle_layout_next,
["<c-u>"] = clear_prompt,
["<c-i>"] = actions.toggle_selection + actions.move_selection_next,
["<c-o>"] = actions.toggle_selection + actions.move_selection_previous,
["<c-p>"] = layout.toggle_preview,
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
["<c-f>"] = actions.results_scrolling_down,
["<c-b>"] = actions.results_scrolling_up,
["<s-down>"] = actions.preview_scrolling_down,
["<s-up>"] = actions.preview_scrolling_up,
["<c-s>"] = actions.select_horizontal,
["<c-x>"] = false,
["<c-c>"] = actions.close,
["<c-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
["<c-l>"] = actions.smart_send_to_loclist + actions.open_loclist,
}
return {
defaults = {
mappings = { i = mappings, n = mappings },
prompt_prefix = " " .. ui.Telescope .. " ",
selection_caret = ui.Play .. " ",
multi_icon = ui.Checkbox .. " ",
scroll_strategy = "limit", -- Don't wrap around in results.
dynamic_preview_title = true,
layout_strategy = "flex",
layout_config = {
width = 0.9,
height = 0.9,
flex = { flip_columns = 180 },
horizontal = { preview_width = 0.5 },
vertical = { preview_height = 0.5 },
},
cycle_layout_list = {
"horizontal",
"vertical",
},
},
pickers = {
buffers = {
mappings = {
n = { x = actions.delete_buffer },
i = { ["<c-x>"] = actions.delete_buffer },
},
},
colorscheme = {
enable_preview = true,
theme = "dropdown",
},
man_pages = {
sections = { "ALL" },
},
spell_suggest = {
theme = "cursor",
},
},
}
end,
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension("fzf")
vim.api.nvim_create_autocmd("User", {
desc = "Enable line number in Telescope previewers.",
group = vim.api.nvim_create_augroup("custom.telescope", { clear = true }),
pattern = "TelescopePreviewerLoaded",
command = "setlocal number",
})
end,
}

View file

@ -1,31 +0,0 @@
return {
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
cmd = "Trouble",
keys = function()
local icon = require("util.icons").ui.TrafficLight
local key = function(lhs, rhs, desc) return { lhs, rhs, desc = icon .. " " .. desc } end
return {
-- stylua: ignore start
key("<leader>T ", "<cmd>Trouble diagnostics<cr>", "[T]rouble diagnostics"),
key("<leader>Td", "<cmd>Trouble lsp_definitions<cr>", "[T]roubldSP [d]efinitions"),
key("<leader>TD", "<cmd>Trouble lsp_declarations<cr>", "[T]rouble LSP [d]eclarations"),
key("<leader>Ti", "<cmd>Trouble lsp_implementations<cr>", "[T]rouble LSP [i]mplementations"),
key("<leader>Tl", "<cmd>Trouble loclist<cr>", "[T]rouble [l]ocation list"),
key("<leader>Tq", "<cmd>Trouble quickfix<cr>", "[T]rouble [q]uickfix list"),
key("<leader>Tr", "<cmd>Trouble lsp_references<cr>", "[T]rouble LSP [r]eferences"),
key("<leader>Ts", "<cmd>Trouble symbols<cr>", "[T]rouble LSP [s]ymbols"),
key("<leader>Tt", "<cmd>Trouble todo<cr>", "[T]rouble [t]odo"),
key("<leader>TT", "<cmd>Trouble lsp_type_definitions<cr>", "[T]rouble LSP [t]ype definition"),
-- stylua: ignore end
}
end,
opts = {
padding = false, -- don't add an extra new line of top of the list
auto_preview = false, -- don't preview automatically
},
}

View file

@ -1,29 +0,0 @@
local ui = require("util.icons").ui
return {
"lukas-reineke/virt-column.nvim",
event = { "BufReadPost", "BufNewFile" },
keys = function()
local enable_many = function() vim.o.colorcolumn = "+1,+21,+41" end
local toggle_single = function()
if vim.o.colorcolumn == "" then
vim.o.colorcolumn = "+1"
else
vim.o.colorcolumn = ""
end
end
return {
{ "<leader>sC", enable_many, desc = ui.Toggle .. " toggle virtual colunns" },
{ "<leader>sc", toggle_single, desc = ui.Toggle .. " toggle one colunn" },
}
end,
opts = {
char = { ui.LineMiddle, ui.LineMiddle, ui.LineMiddle },
highlight = { "VirtColumn1", "VirtColumn2", "VirtColumn3" },
},
}

View file

@ -1,27 +0,0 @@
return {
"ntpeters/vim-better-whitespace",
event = { "BufReadPost", "BufNewFile" },
init = function()
vim.g.better_whitespace_filetypes_blacklist = {
"diff",
"fugitive",
"git",
"gitcommit",
"help",
}
end,
keys = function()
local icon = require("util.icons").ui.Whitespace
return {
-- stylua: ignore start
{ "]w", "<cmd>NextTrailingWhitespace<cr>", desc = icon.." next whitespace" },
{ "[w", "<cmd>PrevTrailingWhitespace<cr>", desc = icon.." previous whitespace" },
{ "<leader>w", "<cmd>ToggleWhitespace<cr>", desc = icon.." toggle whitespace" },
{ "<leader>W", "<cmd>StripWhitespace<cr>", desc = icon.." strip whitespace" },
-- stylua: ignore end
}
end,
}

View file

@ -1,7 +1,7 @@
local M = {}
M.setup = function()
local group = vim.api.nvim_create_augroup("custom", { clear = true })
local group = vim.api.nvim_create_augroup("fschauen", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Briefly highlight yanked text.",

View file

@ -1,5 +1,40 @@
local M = {}
-- Show/navigate warning and errors by default.
M.severity = vim.diagnostic.severity.WARN
-- Go to next/prev diagnostic, but only if next item has a visible virtual text.
-- If we can move, then also center screen at target location.
local conditional_goto = function(condition, move, opts)
opts = vim.tbl_extend("keep", opts or {}, {
wrap = false, -- don't wrap around the begin/end of file
severity = { -- only navigate items with visible virtual text
min = M.severity,
},
})
if condition(opts) then
move(opts)
vim.cmd("normal zz")
else
local level = vim.diagnostic.severity[M.severity] or "???"
local msg = string.format("No more diagnostics [level: %s]", level)
vim.notify(msg, vim.log.levels.WARN)
end
end
---Move to the next diagnostic.
---@param opts table\nil: options passed along to `vim.diagnostic.goto_next`.
M.goto_next = function(opts)
conditional_goto(vim.diagnostic.get_next_pos, vim.diagnostic.goto_next, opts)
end
---Move to the previous diagnostic.
---@param opts table|nil: options passed along to `vim.diagnostic.goto_prev`.
M.goto_prev = function(opts)
conditional_goto(vim.diagnostic.get_prev_pos, vim.diagnostic.goto_prev, opts)
end
---Show diagnostics in a floating window.
---@param opts table|nil: options passed along to `vim.diagnostic.open_float`.
M.open_float = function(opts) vim.diagnostic.open_float(opts) end
@ -7,11 +42,11 @@ M.open_float = function(opts) vim.diagnostic.open_float(opts) end
---Toggle diagnostics in the given buffer.
---@param bufnr integer|nil: Buffer number (0 for current buffer, nil for all buffers.
M.toggle = function(bufnr)
local filter = { bufnr = bufnr or 0 }
if vim.diagnostic.is_enabled(filter) then
vim.diagnostic.enable(false, filter)
bufnr = bufnr or 0
if vim.diagnostic.is_disabled(bufnr) then
vim.diagnostic.enable(bufnr)
else
vim.diagnostic.enable(true, filter)
vim.diagnostic.disable(bufnr)
end
end
@ -19,27 +54,22 @@ end
---@param bufnr integer|nil: Buffer number (0 for current buffer, nil for all buffers.
M.hide = function(bufnr) vim.diagnostic.hide(nil, bufnr or 0) end
local icons = require("util.icons")
local icons = require("fschauen.util.icons")
---Use `Telescope` to set a new diagnostic severity.
M.set_severity = function()
---Select minimum diagnostic severity for which to show virtual text.
M.select_virtual_text_severity = function()
if not pcall(require, "telescope") then
vim.notify("Telescope not available!", vim.log.levels.ERROR)
return
end
local displayer = require("telescope.pickers.entry_display").create {
local display_row = require("telescope.pickers.entry_display").create {
separator = "",
items = { { width = 3 }, { width = 3 }, { remaining = true } },
items = { { width = 3 }, { remaining = true } },
}
local make_display = function(entry)
local severity = vim.F.npcall(
function() return vim.diagnostic.config().signs.severity.min end
)
local marker = severity == entry.value.severity and icons.ui.Checkbox or ""
return displayer {
{ marker, "Comment" },
return display_row {
{ entry.value.icon, entry.value.highlight },
{ entry.value.title, entry.value.highlight },
}
@ -51,12 +81,6 @@ M.set_severity = function()
prompt_title = "Min. severity for virtual text:",
finder = require("telescope.finders").new_table {
results = {
{
title = "Off",
severity = 0,
icon = icons.ui.Off,
highlight = "Comment",
},
{
title = "Error",
severity = vim.diagnostic.severity.ERROR,
@ -87,54 +111,45 @@ M.set_severity = function()
end,
},
sorter = require("telescope.config").values.generic_sorter(opts),
attach_mappings = function(prompt_bufnr)
require("telescope.actions.set").select:replace(function()
attach_mappings = function(prompt_bufnr, _)
local actions = require("telescope.actions")
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = require("telescope.actions.state").get_selected_entry()
require("telescope.actions").close(prompt_bufnr)
M.setup { severity = { min = selection.value.severity } }
M.severity = selection.value.severity or M.severity
vim.diagnostic.config {
virtual_text = {
severity = { min = M.severity },
},
}
end)
return true -- Attach default mappings as well.
return true
end,
})
:find()
end
---Customize nvim's diagnostics display.
M.setup = function(opts)
opts = vim.tbl_deep_extend("keep", opts or {}, {
severity = {
min = vim.diagnostic.severity.HINT,
},
})
M.setup = function()
vim.diagnostic.config {
underline = false,
severity_sort = true,
signs = {
severity = opts.severity,
text = {
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warn,
[vim.diagnostic.severity.INFO] = icons.diagnostics.Info,
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
},
},
virtual_text = {
severity = opts.severity,
prefix = function(_, index, total) return index == total and "" or "" end,
spacing = 6,
prefix = icons.ui.Circle,
severity = {
min = M.severity,
},
},
float = {
border = "rounded",
header = { " " .. icons.ui.Diagnostic .. " Diagnostics:", "Comment" },
prefix = function(_, index, _) return string.format("%2d. ", index), "Comment" end,
},
jump = {
severity = opts.severity,
wrap = false,
float = true,
},
severity_sort = true,
}
for type, icon in pairs(icons.diagnostics) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end
return M

View file

@ -8,12 +8,12 @@ R = function(module)
return require(module)
end
require("config.options").setup()
require("config.keymap").setup()
require("config.diagnostic").setup()
require("config.autocmd").setup()
require("config.filetype").setup()
require("config.lazy").setup()
require("fschauen.options").setup()
require("fschauen.keymap").setup()
require("fschauen.diagnostic").setup()
require("fschauen.autocmd").setup()
require("fschauen.filetype").setup()
require("fschauen.lazy").setup()
local colorscheme = vim.env.NVIM_COLORSCHEME or "gruvbox"
vim.cmd("silent! colorscheme " .. colorscheme)

View file

@ -0,0 +1,122 @@
local M = {}
local map = function(mode, lhs, rhs, opts)
if mode ~= "c" then
opts = opts or {}
opts.silent = opts.silent ~= false -- silent by default
end
vim.keymap.set(mode, lhs, rhs, opts)
end
-- stylua: ignore start
M.setup = function()
-- better navigation for wrapped lines
map("n", "j", "gj")
map("n", "k", "gk")
-- maintain cursor position when joining lines
map("n", "J", "mzJ`z")
-- retain selection when making changes in visual mode
map("v", "<c-a>", "<c-a>gv")
map("v", "<c-x>", "<c-x>gv")
map("v", "g<c-a>", "g<c-a>gv")
map("v", "g<c-x>", "g<c-x>gv")
map("v", ">", "><cr>gv")
map("v", "<", "<<cr>gv")
-- place destination of important movements in the center of the screen
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")
map("n", "*", "*zzzv")
map("n", "#", "#zzzv")
map("n", "g*", "g*zzzv")
map("n", "g#", "g#zzzv")
map("n", "<c-d>", "<c-d>zzzv")
map("n", "<c-u>", "<c-u>zzzv")
-- easier window navigation
map("n", "<c-j>", "<c-w>j")
map("n", "<c-k>", "<c-w>k")
map("n", "<c-h>", "<c-w>h")
map("n", "<c-l>", "<c-w>l")
-- disable highlight until next search
map("n", "<cr>", "<cmd>nohlsearch<cr>")
local window = require("fschauen.util.window")
-- window resizing
map("n", "<s-Up>", window.resize_up(2), { desc = "Resize window upward" })
map("n", "<s-Down>", window.resize_down(2), { desc = "Resize window downward" })
map("n", "<s-Left>", window.resize_left(2), { desc = "Resize window leftward" })
map("n", "<s-Right>", window.resize_right(2), { desc = "Resize window rightward" })
-- easy tab navigation
map("n", "<Right>", "<cmd>tabnext<cr>")
map("n", "<Left>", "<cmd>tabprevious<cr>")
-- move lines up and down
map("n", "<c-a-j>", [[:move .+1<cr>==]])
map("n", "<c-a-k>", [[:move .-2<cr>==]])
map("v", "<c-a-j>", [[:move '>+1<cr>gv=gv]])
map("v", "<c-a-k>", [[:move '<-2<cr>gv=gv]])
map("i", "<c-a-j>", [[<esc>:move .+1<cr>==gi]])
map("i", "<c-a-k>", [[<esc>:move .-2<cr>==gi]])
-- move to begin/end of line in insert mode
map("i", "<c-a>", "<c-o>^")
map("i", "<c-e>", "<c-o>$")
-- move to begin of line in command mode (<c-e> moves to end by default)
map("c", "<c-a>", "<c-b>")
-- more convenient way of entering normal mode from terminal mode
map("t", [[<c-\><c-\>]], [[<c-\><c-n>]])
-- recall older/recent command-line from history
map("c", "<c-j>", "<down>")
map("c", "<c-k>", "<up>")
-- trigger InsertLeave when leaving Insert mode with ctrl-c (see :help i_CTRL-C)
map("i", "<c-c>", "<esc>")
-- quickly change background
map("n", "<leader>bg", [[<cmd>let &background = &background ==? "light" ? "dark" : "light"<cr>]])
-- don't loose the original yanked contents when pasting in visual mode
map("x", "<leader>p", [["_dP]])
local diagnostic = require("fschauen.diagnostic")
local ui = require("fschauen.util.icons").ui
-- navigate diagnostics
map("n", "]d", diagnostic.goto_next, { desc = ui.Diagnostic.." [d]iagnostic [n]ext" })
map("n", "[d", diagnostic.goto_prev, { desc = ui.Diagnostic.." [d]iagnostic [p]revious" })
map("n", "<leader>dd", diagnostic.toggle, { desc = ui.Diagnostic.." [d]iagnostic enable/[d]isable" })
map("n", "<leader>do", diagnostic.open_float, { desc = ui.Diagnostic.." [d]iagnostic [o]pen" })
map("n", "<leader>dh", diagnostic.hide, { desc = ui.Diagnostic.." [d]iagnostic [h]ide" })
map("n", "<leader>ds", diagnostic.select_virtual_text_severity, { desc = ui.Diagnostic.." [d]iagnostic [s]everity" })
-- navigate items in quickfix and location lists
map("n", "<leader>j", "<cmd>cnext<cr>zz")
map("n", "<leader>k", "<cmd>cprevious<cr>zz")
map("n", "<localleader>j", "<cmd>lnext<cr>zz")
map("n", "<localleader>k", "<cmd>lprevious<cr>zz")
-- toggle quickfix and loclist
map("n", "<leader>ll", window.toggle_quickfix, { desc = ui.Toggle.." toggle quickfix" })
map("n", "<localleader>ll", window.toggle_loclist, { desc = ui.Toggle.." toggle loclist" })
local options = require("fschauen.util.options")
-- toggle options
map("n", "<leader>sn", options.toggle_number, { desc = ui.Toggle.." toggle 'number'" })
map("n", "<leader>sr", options.toggle_relativenumber, { desc = ui.Toggle.." toggle 'relativenumber'" })
map("n", "<leader>sl", options.toggle_list, { desc = ui.Toggle.." toggle 'list'" })
map("n", "<leader>sw", options.toggle_wrap, { desc = ui.Toggle.." toggle 'wrap'" })
map("n", "<leader>ss", options.toggle_spell, { desc = ui.Toggle.." toggle 'spell'" })
end
-- stylua: ignore end
return M

View file

@ -1,7 +1,7 @@
local M = {}
local bootstrap = function(path)
if not vim.uv.fs_stat(path) then
if not vim.loop.fs_stat(path) then
vim.fn.system {
"git",
"clone",
@ -21,7 +21,7 @@ local dev_path = function()
"~/.local/src",
}
paths = vim.tbl_map(vim.fn.expand, paths)
paths = vim.tbl_filter(vim.uv.fs_stat, paths)
paths = vim.tbl_filter(vim.loop.fs_stat, paths)
return paths[1]
end
@ -33,7 +33,7 @@ M.setup = function()
end
lazy.setup {
spec = "config.plugins",
spec = "fschauen.plugins",
dev = {
path = dev_path(),
fallback = true,

View file

@ -7,7 +7,7 @@ return {
{
"<leader>gb",
"<cmd>BlameToggle<cr>",
desc = require("util.icons").ui.Git .. " [g]it [b]lame (blame.nvim)",
desc = require("fschauen.util.icons").ui.Git .. " [g]it [b]lame (blame.nvim)",
},
},

View file

@ -4,7 +4,7 @@ return {
cmd = "Commentary",
keys = function()
local icon = require("util.icons").ui.Comment
local icon = require("fschauen.util.icons").ui.Comment
return {
-- stylua: ignore start
{ "gc", "<Plug>Commentary", mode = {"n", "x", "o"}, desc = icon.." Comment in/out" },

View file

@ -85,7 +85,7 @@ return {
formatting = {
format = require("lspkind").cmp_format {
mode = "symbol_text",
symbol_map = require("util.icons").kind,
symbol_map = require("fschauen.util.icons").kind,
menu = {
buffer = "buf",
nvim_lsp = "LSP",

View file

@ -11,7 +11,7 @@ return {
return function() return require("dial.map")[cmd]() .. suffix end
end
local icons = require("util.icons")
local icons = require("fschauen.util.icons")
local inc, dec = icons.ui.Increment, icons.ui.Decrement
return {

View file

@ -1,3 +1,5 @@
local icons = require("fschauen.util.icons")
return {
"j-hui/fidget.nvim",
@ -7,7 +9,7 @@ return {
opts = {
text = {
done = require("util.icons").ui.Checkmark,
done = icons.ui.Checkmark,
spinner = {
"▱▱▱▱▱▱▱",
"▰▱▱▱▱▱▱",

View file

@ -32,11 +32,11 @@ return {
},
keys = function()
local icon = require("util.icons").ui.Format
local icon = require("fschauen.util.icons").ui.Format
return {
{
"<leader>F",
require("util.autoformat").toggle,
require("fschauen.util.autoformat").toggle,
desc = icon .. " Toggle auto [F]ormat on write",
},
{

View file

@ -4,7 +4,7 @@ return {
cmd = { "G", "Git" },
keys = function()
local icon = require("util.icons").ui.Git
local icon = require("fschauen.util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gS", "<cmd>tab Git<cr>", desc = icon.." [g]it [S]status (fugitive)" },

View file

@ -4,7 +4,7 @@ return {
cmd = "GitMessenger",
keys = function()
local icon = require("util.icons").ui.Git
local icon = require("fschauen.util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gm", "<cmd>GitMessenger<cr>", desc = icon.." [g]it [m]essenger" },

View file

@ -26,7 +26,7 @@ return {
end
end
local icon = require("util.icons").ui.Git
local icon = require("fschauen.util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gr", open_repo, desc = icon.." open [r]epository in browser" },

View file

@ -1,4 +1,4 @@
local ui = require("util.icons").ui
local ui = require("fschauen.util.icons").ui
return {
"lukas-reineke/indent-blankline.nvim",

View file

@ -0,0 +1,136 @@
local border = { border = "rounded" }
local lsp_capabilities = function()
local basic = vim.lsp.protocol.make_client_capabilities()
local completion = vim.F.npcall(require, "cmp_nvim_lsp")
if completion then
return vim.tbl_deep_extend("force", basic, completion.default_capabilities())
end
return basic
end
local lsp_handlers = function()
return {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, border),
["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help,
border
),
}
end
local lsp_on_attach = function(--[[client]]_, buffer)
local map, opts = vim.keymap.set, { buffer = buffer }
-- stylua: ignore start
map("n", "<localleader>c", vim.lsp.buf.code_action, opts)
map("n", "<localleader>f", vim.lsp.buf.format, opts)
map("n", "gd", vim.lsp.buf.definition, opts)
map("n", "gD", vim.lsp.buf.declaration, opts)
map("n", "gi", vim.lsp.buf.implementation, opts)
map("n", "grr", vim.lsp.buf.rename, opts)
map("n", "gt", vim.lsp.buf.type_definition, opts)
map("n", "K", vim.lsp.buf.hover, opts)
map("i", "<c-,>", vim.lsp.buf.signature_help, opts)
-- stylua: ignore end
end
local lsp_on_init = function(client)
-- Opt out of semantic highlighting because it has been causing the issues
-- https://github.com/neovim/nvim-lspconfig/issues/2542#issuecomment-1547019213
if client.server_capabilities then
client.server_capabilities.semanticTokensProvider = false
end
end
local server_opts = setmetatable({
lua_ls = function(opts)
return vim.tbl_deep_extend("force", opts, {
settings = {
Lua = {
-- I'm using lua only inside neovim, so the runtime is LuaJIT.
runtime = { version = "LuaJIT" },
-- Get the language server to recognize the `vim` global.
diagnostics = { globals = { "vim" } },
-- Make the server aware of Neovim runtime files.
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
})
end,
omnisharp = function(opts)
return vim.tbl_deep_extend("force", opts, {
-- Use .editoconfig for code style, naming convention and analyzer settings.
enable_editorconfig_support = true,
-- Show unimported types and add`using` directives.
enable_import_completion = true,
-- Enable roslyn analyzers, code fixes, and rulesets.
enable_roslyn_analyzers = true,
-- Don't include preview versions of the .NET SDK.
sdk_include_prereleases = false,
handlers = {
["textDocument/definition"] = require("omnisharp_extended").handler,
},
})
end,
}, {
-- The default is a just a passthrough of the options.
__index = function()
return function(opts) return opts end
end,
})
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"Hoffs/omnisharp-extended-lsp.nvim",
},
cmd = "Mason",
event = { "BufReadPre", "BufNewFile" },
config = function()
local icons = require("fschauen.util.icons")
require("lspconfig.ui.windows").default_options = border
require("mason").setup {
ui = {
border = border.border,
icons = {
package_installed = icons.git.file.Staged,
package_pending = icons.git.file.Unstaged,
package_uninstalled = icons.git.file.Deleted,
},
},
}
require("mason-lspconfig").setup {
ensure_installed = {},
handlers = {
function(server_name)
require("lspconfig")[server_name].setup(server_opts[server_name] {
capabilities = lsp_capabilities(),
handlers = lsp_handlers(),
on_attach = lsp_on_attach,
lsp_on_init = lsp_on_init,
})
end,
},
}
end,
}

View file

@ -0,0 +1,56 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
opts = function()
local dynamic_color = require("fschauen.util.lualine").dynamic_color
local window = require("fschauen.util.window")
local orange = "#d65d0e"
local autoformat = require("fschauen.util.autoformat").lualine()
local branch = {
"branch",
icon = require("fschauen.util.icons").git.Branch,
cond = window.is_medium,
}
local diagnostics = dynamic_color("diagnostics")
local fileformat = { "fileformat", cond = window.is_medium }
local filename = "fschauen.filename"
local filetype = { dynamic_color("filetype"), cond = window.is_medium }
local mode = "fschauen.mode"
local searchcount = "fschauen.searchcount"
local spell = "fschauen.spell"
local status =
{ dynamic_color("fschauen.status"), color = { fg = orange }, padding = 0 }
local whitespace = { dynamic_color("fschauen.whitespace"), color = { bg = orange } }
local wrap = "fschauen.wrap"
local sections = {
lualine_a = { mode },
lualine_b = { branch },
lualine_c = { filename, status },
lualine_x = { diagnostics, searchcount, filetype },
lualine_y = { spell, wrap, autoformat, fileformat, "progress" },
lualine_z = { "location", whitespace },
}
return {
options = {
icons_enabled = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = sections,
inactive_sections = sections,
extensions = {
"fugitive",
"quickfix",
"nvim-tree",
"lazy",
"man",
"trouble",
},
}
end,
}

View file

@ -22,10 +22,10 @@ return {
end,
config = function()
local icon = require("util.icons").ui.Markdown
local icon = require("fschauen.util.icons").ui.Markdown
vim.api.nvim_create_autocmd("FileType", {
desc = "Create key map to toggle markdown preview.",
group = vim.api.nvim_create_augroup("custom.markdown", { clear = true }),
group = vim.api.nvim_create_augroup("fschauen.markdown", { clear = true }),
pattern = "markdown",
callback = function()
vim.keymap.set(

View file

@ -2,7 +2,7 @@ return {
"danymat/neogen",
keys = function()
local icon = require("util.icons").ui.Annotation
local icon = require("fschauen.util.icons").ui.Annotation
return {
{
"<leader>aa",

View file

@ -1,4 +1,4 @@
local ui = require("util.icons").ui
local ui = require("fschauen.util.icons").ui
return {
"NeogitOrg/neogit",
@ -12,17 +12,8 @@ return {
},
opts = {
commit_editor = {
kind = "tab",
show_staged_diff = false,
},
disable_insert_on_commit = true,
commit_editor = { kind = "tab" },
disable_hint = true,
graph_style = "unicode",
signs = {
section = {
ui.Folder,

View file

@ -0,0 +1,18 @@
return {
"2kabhishek/nerdy.nvim",
cmd = "Nerdy",
dependencies = {
"stevearc/dressing.nvim",
"nvim-telescope/telescope.nvim",
},
keys = function()
local helper = require("fschauen.plugins.telescope").keymap_helper
local lhs, desc = helper.lhs, helper.description
return {
{ lhs("i"), "<cmd>Nerdy<cr>", desc = desc("Nerd [i]cons") },
}
end,
}

View file

@ -6,7 +6,7 @@ return {
{
"<leader>L",
function() require("lint").try_lint() end,
desc = require("util.icons").ui.Lint .. " [L]int file",
desc = require("fschauen.util.icons").ui.Lint .. " [L]int file",
},
}
end,

View file

@ -18,13 +18,14 @@ return {
local dismiss_notifications = function() require("notify").dismiss() end
local keymap = require("config.plugins.telescope").keymap
local helper = require("fschauen.plugins.telescope").keymap_helper
local lhs, desc = helper.lhs, helper.description
return {
-- stylua: ignore start
{ "<leader>n", "<cmd>Notifications<cr>", desc = "Display notification history" },
{ "<c-q>", dismiss_notifications, desc = "Dismiss notifications" },
keymap { "n", telescope_notifications, desc = "[n]otifications" },
{ lhs("n"), telescope_notifications, desc = desc("[n]otifications") },
-- stylua: ignore end
}
end,
@ -33,7 +34,7 @@ return {
config = function()
local notify = require("notify")
local icons = require("util.icons")
local icons = require("fschauen.util.icons")
notify.setup {
icons = {

View file

@ -22,7 +22,7 @@ local on_attach = function(buffer)
-- stylua: ignore end
end
local icons = require("util.icons")
local icons = require("fschauen.util.icons")
return {
"nvim-tree/nvim-tree.lua",

View file

@ -8,7 +8,7 @@ return {
},
keys = function()
local icon = require("util.icons").ui.Web
local icon = require("fschauen.util.icons").ui.Web
return {
{
"<leader>o",

View file

@ -17,14 +17,14 @@ return {
local cmdline = [[which plantuml | xargs cat | grep plantuml.jar]]
local regex = [[\v\s['"]?(\S+/plantuml\.jar)]]
local jar = vim.fn.matchlist(vim.fn.system(cmdline), regex)[2]
if jar and vim.uv.fs_stat(jar) then
if jar and vim.loop.fs_stat(jar) then
vim.g["plantuml_previewer#plantuml_jar_path"] = jar
end
end,
config = function()
local icon = require("util.icons").ui.Graph
local group = vim.api.nvim_create_augroup("custom.plantuml", { clear = true })
local icon = require("fschauen.util.icons").ui.Graph
local group = vim.api.nvim_create_augroup("fschauen.plantuml", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
desc = "Create key map to toggle plantuml preview.",
group = group,

View file

@ -0,0 +1,19 @@
return {
"nvim-telescope/telescope-file-browser.nvim",
dependencies = "nvim-telescope/telescope.nvim",
keys = function()
local helper = require("fschauen.plugins.telescope").keymap_helper
local lhs, desc = helper.lhs, helper.description
return {
{
lhs("B"),
"<cmd>Telescope file_browser theme=ivy<cr>",
desc = desc("file [B]rowser"),
},
}
end,
config = function() require("telescope").load_extension("file_browser") end,
}

View file

@ -0,0 +1,189 @@
local ui = require("fschauen.util.icons").ui
---Create the left hand side for a Telescope keymap.
local lhs = function(keys) return "<leader>f" .. keys end
---Create the description for a Telescope keymap.
local desc = function(text) return ui.Telescope .. " Telescope " .. text end
local builtin_picker = function(name, opts)
return function(title)
return function()
local picker = require("telescope.builtin")[name]
picker(vim.tbl_extend("force", opts or {}, {
prompt_title = title,
}))
end
end
end
local pickers = setmetatable({
all_files = builtin_picker("find_files", {
hidden = true,
no_ignore = true,
no_ignore_parent = true,
}),
all_man_pages = builtin_picker("man_pages", {
sections = { "ALL" },
}),
colorscheme = builtin_picker("colorscheme", { enable_preview = true }),
diagnostics = builtin_picker("diagnostics", { bufnr = 0 }),
dotfiles = builtin_picker("find_files", { cwd = "~/.dotfiles", hidden = true }),
selection = function(title)
return function()
local text = require("fschauen.util").get_selected_text()
return require("telescope.builtin").grep_string {
prompt_title = string.format(title .. ": %s ", text),
search = text,
}
end
end,
here = builtin_picker("current_buffer_fuzzy_find"),
}, {
-- Fall back to telescope's built-in pickers if a custom one is not defined
-- above, but make sure to keep the title we defined.
__index = function(_, key) return builtin_picker(key) end,
})
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release "
.. "&& cmake --build build --config Release "
.. "&& cmake --install build --prefix build",
},
cmd = "Telescope",
keymap_helper = { lhs = lhs, description = desc },
keys = {
-- stylua: ignore start
{ lhs"a", pickers.autocommands " Autocommands" , desc = desc("[a]utocommands") },
{ lhs"b", pickers.buffers " Buffers" , desc = desc("[b]uffers") },
--lhs"B" used in telescope-file-browser
{ lhs"c", pickers.colorscheme " Colorschemes" , desc = desc("[c]olorschemes") },
{ lhs"C", pickers.commands " Commands" , desc = desc("[C]ommands") },
{ lhs"d", pickers.diagnostics "󰀪 Diagnostics" , desc = desc("[d]iagnostics") },
--lhs"e"
{ lhs"f", pickers.find_files " Files" , desc = desc("[f]ind files") },
{ lhs"F", pickers.all_files " ALL files" , desc = desc("all [F]iles") },
{ lhs"gr", pickers.live_grep " Live grep" , desc = desc("Live [gr]ep") },
{ lhs"gf", pickers.git_files " Git files" , desc = desc("[g]it [f]iles") },
{ lhs"gc", pickers.git_commits " Commits" , desc = desc("[g]it [c]ommits") },
{ lhs"h", pickers.here " Current buffer" , desc = desc("[b]uffer [h]ere") },
{ lhs"H", pickers.highlights "󰌶 Highlights" , desc = desc("[H]ighlights") },
--lhs"i" used in nerdy
{ lhs"j", pickers.jumplist " Jumplist" , desc = desc("[j]umplist") },
{ lhs"k", pickers.keymaps " Keymaps" , desc = desc("[k]eymaps") },
{ lhs"K", pickers.help_tags " Help tags" , desc = desc("[K] help/documentation") },
{ lhs"l", pickers.loclist " Location list" , desc = desc("[l]ocation List") },
{ lhs"m", pickers.all_man_pages " Man pages" , desc = desc("[m]an pages") },
--lhs"n" used in vim-notify
{ lhs"o", pickers.vim_options " Vim options" , desc = desc("[o]ptions") },
--lhs"p"
{ lhs"q", pickers.quickfix " Quickfix" , desc = desc("[q]uickfix") },
{ lhs"r", pickers.lsp_references " References" , desc = desc("[r]eferences") },
{ lhs"R", pickers.registers "󱓥 Registers" , desc = desc("[R]registers") },
{ lhs"s", pickers.lsp_document_symbols "󰫧 Document Symbols " , desc = desc("LSP document [s]ymbols") },
{ lhs"S", pickers.lsp_workspace_symbols "󱄑 Workspace Symbols " , desc = desc("LSP workspace [S]ymbols") },
--lhs"t" used in todo_comments
{ lhs"T", pickers.treesitter " Treesitter symbols" , desc = desc("[T]reesitter Symbols") },
--lhs"u"
--lhs"v"
{ lhs"w", pickers.selection " Grep" , desc = desc("[w]word under cursor") },
{ lhs"w", pickers.selection " Grep", mode = "v" , desc = desc("[w]ord(s) selected") },
--lhs"x"
--lhs"y"
{ lhs"z", pickers.spell_suggest "󰓆 Spelling suggestions" , desc = desc("[z] spell suggestions") },
{ lhs".", pickers.dotfiles " Dotfiles" , desc = desc("[.]dotfiles") },
{ lhs":", pickers.command_history " Command history" , desc = desc("[:]command history") },
{ lhs"/", pickers.search_history " Search history" , desc = desc("[/]search history") },
{ lhs"<leader>", pickers.resume "󰐎 Resume" , desc = desc("Resume ") },
-- stylua: ignore end
},
opts = function()
local actions = require("telescope.actions")
local layout = require("telescope.actions.layout")
local state = require("telescope.actions.state")
local clear_prompt = function(prompt_bufnr)
state.get_current_picker(prompt_bufnr):reset_prompt()
end
local mappings = {
["<c-y>"] = layout.cycle_layout_next,
["<c-u>"] = clear_prompt,
["<c-i>"] = actions.toggle_selection + actions.move_selection_next,
["<c-o>"] = actions.toggle_selection + actions.move_selection_previous,
["<c-p>"] = layout.toggle_preview,
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
["<c-f>"] = actions.results_scrolling_down,
["<c-b>"] = actions.results_scrolling_up,
["<s-down>"] = actions.preview_scrolling_down,
["<s-up>"] = actions.preview_scrolling_up,
["<c-s>"] = actions.select_horizontal,
["<c-x>"] = false,
["<c-c>"] = actions.close,
["<c-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
["<c-l>"] = actions.smart_send_to_loclist + actions.open_loclist,
}
return {
defaults = {
mappings = { i = mappings, n = mappings },
prompt_prefix = " " .. ui.Telescope .. " ",
selection_caret = ui.Play .. " ",
multi_icon = ui.Checkbox .. " ",
scroll_strategy = "limit", -- Don't wrap around in results.
dynamic_preview_title = true,
layout_strategy = "flex",
layout_config = {
width = 0.9,
height = 0.9,
flex = { flip_columns = 180 },
horizontal = { preview_width = 0.5 },
vertical = { preview_height = 0.5 },
},
cycle_layout_list = {
"horizontal",
"vertical",
},
},
pickers = {
buffers = {
mappings = {
n = { x = actions.delete_buffer },
i = { ["<c-x>"] = actions.delete_buffer },
},
},
colorscheme = { theme = "dropdown" },
spell_suggest = { theme = "cursor" },
},
}
end,
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension("fzf")
vim.api.nvim_create_autocmd("User", {
desc = "Enable line number in Telescope previewers.",
group = vim.api.nvim_create_augroup("fschauen.telescope", { clear = true }),
pattern = "TelescopePreviewerLoaded",
command = "setlocal number",
})
end,
}

View file

@ -10,17 +10,15 @@ return {
"TextCaseStartReplacingCommand",
},
dev = true,
keys = function()
local icon = require("util.icons").ui.Text
local icon = require("fschauen.util.icons").ui.Text
local description = icon .. " [c]hange text [c]ase"
local theme = function() return require("telescope.themes").get_cursor() end
return {
{
"<leader>cc",
function() require("config.plugins.telescope").extensions.textcase.normal_mode(theme()) end,
function() require("telescope").extensions.textcase.normal_mode(theme()) end,
mode = "n",
desc = description,
},
@ -55,6 +53,6 @@ return {
require("textcase").setup {
default_keymappings_enabled = false,
}
require("config.plugins.telescope").load_extension("textcase")
require("telescope").load_extension("textcase")
end,
}

View file

@ -1,5 +1,3 @@
local keymap = require("config.plugins.telescope").keymap
return {
"folke/todo-comments.nvim",
@ -10,12 +8,16 @@ return {
event = { "BufReadPost", "BufNewFile" },
keys = {
keymap { "t", "<cmd>TodoTelescope<cr>", desc = "[t]odos" },
},
keys = function()
local helper = require("fschauen.plugins.telescope").keymap_helper
local lhs, desc = helper.lhs, helper.description
return {
{ lhs("t"), "<cmd>TodoTelescope<cr>", desc = desc("[t]odos") },
}
end,
opts = function()
local ui = require("util.icons").ui
local ui = require("fschauen.util.icons").ui
return {
keywords = {
TODO = { icon = ui.Checkbox },

View file

@ -14,7 +14,7 @@ return {
event = "VeryLazy",
keys = function()
local icon = require("util.icons").ui.Tree
local icon = require("fschauen.util.icons").ui.Tree
return {
-- stylua: ignore start

View file

@ -0,0 +1,21 @@
return {
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
keys = function()
local icon = require("fschauen.util.icons").ui.TrafficLight
return {
-- stylua: ignore start
{ "<leader>lt", "<cmd>TroubleToggle<cr>", desc = icon.." trouble [t]toggle" },
{ "<leader>lw", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = icon.." trouble [w]orkspace" },
{ "<leader>ld", "<cmd>TroubleToggle document_diagnostics<cr>", desc = icon.." trouble [d]ocument" },
-- stylua: ignore end
}
end,
opts = {
padding = false, -- don't add an extra new line of top of the list
auto_preview = false, -- don't preview automatically
},
}

View file

@ -12,7 +12,7 @@ return {
end,
keys = function()
local icon = require("util.icons").ui.Undo
local icon = require("fschauen.util.icons").ui.Undo
return {
{ "<leader>u", "<cmd>UndotreeToggle<cr>", desc = icon .. " toggle [u]ndo tree" },
}

View file

@ -0,0 +1,25 @@
local ui = require("fschauen.util.icons").ui
return {
"lukas-reineke/virt-column.nvim",
event = { "BufReadPost", "BufNewFile" },
keys = function()
local toggle_colorcolumn = function()
if vim.o.colorcolumn == "" then
vim.o.colorcolumn = "+1" -- one after 'textwidth'
else
vim.o.colorcolumn = "" -- none
end
end
return {
{ "<leader>sc", toggle_colorcolumn, desc = ui.Toggle .. " toggle virtual colunn" },
}
end,
opts = {
char = ui.LineMiddle,
},
}

View file

@ -0,0 +1,27 @@
return {
"ntpeters/vim-better-whitespace",
event = { "BufReadPost", "BufNewFile" },
init = function()
vim.g.better_whitespace_filetypes_blacklist = {
"diff",
"fugitive",
"git",
"gitcommit",
"help",
}
end,
keys = function()
local icon = require("fschauen.util.icons").ui.Whitespace
return {
-- stylua: ignore start
{ "<leader>ww", "<cmd>ToggleWhitespace<cr>", desc = icon.." toggle whitespace" },
{ "<leader>wj", "<cmd>NextTrailingWhitespace<cr>", desc = icon.." next whitespace" },
{ "<leader>wk", "<cmd>PrevTrailingWhitespace<cr>", desc = icon.." previous whitespace" },
{ "<leader>W", "<cmd>StripWhitespace<cr>", desc = icon.." strip whitespace" },
-- stylua: ignore end
}
end,
}

View file

@ -4,18 +4,18 @@ M._augroup = nil
---Whether autoformatting is enabled.
---@return boolean
M.is_enabled = function() return M._augroup ~= nil end
local is_enabled = function() return M._augroup ~= nil end
---Disable autoformatting.
M.disable = function()
if not M.is_enabled() then return end
if not is_enabled() then return end
vim.api.nvim_del_augroup_by_id(M._augroup)
M._augroup = nil
end
---Enable autoformatting.
M.enable = function()
if M.is_enabled() then return end
if is_enabled() then return end
local ok, formatter = pcall(require, "formatter.format")
if not ok then
@ -23,7 +23,7 @@ M.enable = function()
return
end
M._augroup = vim.api.nvim_create_augroup("custom.autoformat", { clear = true })
M._augroup = vim.api.nvim_create_augroup("fschauen.autoformat", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
desc = "Format files on write.",
group = M._augroup,
@ -34,11 +34,21 @@ end
---Toggle autoformatting.
M.toggle = function()
if M.is_enabled() then
if is_enabled() then
M.disable()
else
M.enable()
end
end
---Create a lualine component that shows an icon when autoformatting is enabled.
---@return table component
M.lualine = function()
local icon = require("fschauen.util.icons").ui.Format
return {
function() return icon end,
cond = is_enabled,
}
end
return M

View file

@ -114,17 +114,14 @@ M.ui = {
Markdown = "",
Modified = "",
Note = "", -- 
Off = "",
Paste = "",
Play = "",
ReadOnly = "", -- "RO",
Search = "", -- 
Sleep = "󰒲",
SpellCheck = "󰓆",
Telescope = "",
TestTube = "󰙨", -- 󰤑
Text = "󰬴",
TextWrap = "󰖶",
Toggle = "󰨚",
TrafficLight = "󱠪",
Tree = "",

View file

@ -4,8 +4,7 @@ local M = {}
---@param path string: file or directory path.
---@return string|boolean: type if path exists, false otherwise.
M.exists = function(path)
---@diagnostic disable-next-line: undefined-field
local stat = vim.uv.fs_stat(path)
local stat = vim.loop.fs_stat(path)
return (stat and stat.type) or false
end

View file

@ -1,5 +1,8 @@
local M = {}
local util = require("fschauen.util")
local exists = util.exists
---Find lua module source.
---@param modname string Module name.
---@return table results List of source files in the runtime path that implement
@ -9,8 +12,6 @@ local find_module_sources = function(modname)
local base = "lua/" .. modname:gsub("%.", "/")
local candidates = { base .. ".lua", base .. "/init.lua" }
local exists = require("util").exists
local results = {}
for _, directory in ipairs(vim.opt.runtimepath:get()) do
for _, candidate in ipairs(candidates) do
@ -28,7 +29,7 @@ end
M.execute_lines = function(first, last)
first = first or vim.fn.line(".")
last = last or first
local code = vim.iter(vim.fn.getline(first, last)):join("\n")
local code = vim.fn.join(vim.fn.getline(first, last), "\n")
loadstring(code)()
end

View file

@ -0,0 +1,41 @@
local M = {}
---Make a lualine component that is colored only when focused.
---@param base table|string Either a lualine component or a component name.
---@return table component
M.dynamic_color = function(base)
local component = {}
if type(base) == "string" then
component = require("lualine.components." .. base):extend()
elseif type(base) == "table" then
component = base:extend()
else
return component
end
function component:init(options)
component.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
colored = true,
dynamic_color = true,
})
)
self.saved_highlight = self.options.color_highlight
end
function component:update_status(is_focused)
if self.options.dynamic_color then self.options.colored = is_focused end
return component.super.update_status(self, is_focused)
end
function component:draw(default_highlight, is_focused)
self.options.color_highlight = self.options.colored and self.saved_highlight or nil
return component.super.draw(self, default_highlight, is_focused)
end
return component
end
return M

View file

@ -1,34 +0,0 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_extend("keep", options or {}, {
maxcount = 999,
timeout = 250,
cond = function() return vim.v.hlsearch == 1 end,
})
)
end
local denominator = function(tbl)
if tbl.total > tbl.maxcount then return "󰛤" end
return string.format("%d", tbl.total)
end
local render = function(tbl)
local status = "?"
if not vim.tbl_isempty(tbl) and vim.v.hlsearch == 1 then
status = string.format("%d/%s", tbl.current, denominator(tbl))
end
return string.format(" %s", status)
end
function M:update_status()
return render(vim.fn.searchcount {
maxcount = self.options.maxcount,
timeout = self.options.timeout,
})
end
return M

View file

@ -1,25 +0,0 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
color = { fg = "#d65d0e" },
cond = function() return vim.bo.filetype ~= "help" end,
})
)
end
local TRAILING_WS_PATTERN = [[\s\+$]]
local total = function()
local count = vim.fn.searchcount({ pattern = TRAILING_WS_PATTERN }).total
return count > 1 and string.format("·%d", count) or ""
end
function M:update_status(--[[is_focused]]_)
local lineno = vim.fn.search(TRAILING_WS_PATTERN, "nwc")
return lineno > 0 and string.format("󰢤 %d%s", lineno, total()) or ""
end
return M

View file

@ -23,7 +23,7 @@ function M:update_status(is_focused)
local path = vim.fn.expand("%:~:.")
local window = require("util.window")
local window = require("fschauen.util.window")
if window.is_wide() then
return path
elseif window.is_medium() then

View file

@ -0,0 +1,27 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_extend("keep", options or {}, {
maxcount = 999,
timeout = 250,
})
)
end
function M:update_status()
if vim.v.hlsearch == 0 then return "" end
local count = vim.fn.searchcount {
maxcount = self.options.maxcount,
timeout = self.options.timeout,
}
if next(count) == nil then return "" end
local denominator = count.total > count.maxcount and "󰛤"
or string.format("%d", count.total)
return string.format(" %d/%s", count.current, denominator)
end
return M

View file

@ -0,0 +1,14 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
cond = function() return vim.o.spell end,
})
)
end
function M:update_status(--[[is_focused]]_) return "󰓆" end
return M

View file

@ -0,0 +1,26 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
color = { bg = "#d65d0e" },
cond = function() return vim.bo.filetype ~= "help" end,
})
)
end
function M:update_status(--[[is_focused]]_)
local trailing = [[\s\+$]]
local lineno = vim.fn.search(trailing, "nwc")
if lineno == 0 then return "" end
local result = "" .. lineno
local total = vim.fn.searchcount({ pattern = trailing }).total
if total > 1 then result = result .. string.format(" (%d total)", total) end
return result
end
return M

View file

@ -0,0 +1,14 @@
local M = require("lualine.component"):extend()
function M:init(options)
M.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
cond = function() return vim.o.wrap end,
})
)
end
function M:update_status(--[[is_focused]]_) return "󰖶" end
return M

View file

@ -1,72 +0,0 @@
local M = {}
---Make a lualine component that is colored only when focused.
---@param base table|string Either a lualine component or a component name.
---@return table component
M.colored_when_focused = function(base)
local component = {}
if type(base) == "string" then
component = require("lualine.components." .. base):extend()
elseif type(base) == "table" then
component = base:extend()
else
return component
end
function component:init(options)
component.super.init(
self,
vim.tbl_deep_extend("keep", options or {}, {
colored = true,
colored_when_focused = true,
})
)
self.saved_highlight = self.options.color_highlight
end
function component:update_status(is_focused)
if self.options.colored_when_focused then self.options.colored = is_focused end
return component.super.update_status(self, is_focused)
end
function component:draw(default_highlight, is_focused)
self.options.color_highlight = self.options.colored and self.saved_highlight or nil
return component.super.draw(self, default_highlight, is_focused)
end
return component
end
---@class LualineIndicatorSpec
---@field icon string The icon to show when the indicator is active.
---@field cond function A function that returns true when the indicator should
--- be visible, false otherwise.
---Make a lualine indicator that shows an icon when a condition is true.
---@param spec LualineIndicatorSpec
---@return table component
M.indicator = function(spec)
vim.validate("spec", spec, "table")
vim.validate("spec.icon", spec.icon, "string")
vim.validate("spec.cond", spec.cond, "function")
local component = require("lualine.component"):extend()
function component:init(options)
component.super.init(
self,
vim.tbl_deep_extend(
"keep",
options or {},
{ cond = spec.cond or function() return false end }
)
)
end
function component:update_status(--[[is_focused]]_) return spec.icon or "?" end
return component
end
return M

View file

@ -109,10 +109,3 @@ Ardia
Chromeleon
eluent
fluidics
WebSocket
DDK
MQTT
REQ
BSON
Toolchain
toolchain

View file

@ -6,21 +6,19 @@ set -g prefix C-space
bind C-space send-prefix
bind R source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"\; display "RELOADED"
bind v copy-mode
bind P choose-buffer "paste-buffer -b '%%' -s ''"
bind p paste-buffer -s ''
bind p paste-buffer
bind C command-prompt -p 'Save pane history:' \
-I '~/tmux.history' \
'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Window/pane management (new windows/panes use the path in current pane)
bind c new-window -c '#{pane_current_path}'
bind C-v split-window -h -c '#{pane_current_path}'
bind M-v split-window -h -c '#{pane_current_path}' -f
bind C-s split-window -v -c '#{pane_current_path}'
bind M-s split-window -v -c '#{pane_current_path}' -f
bind | split-window -h -c '#{pane_current_path}'
bind \\ split-window -h -c '#{pane_current_path}' -f
bind - split-window -v -c '#{pane_current_path}'
bind _ split-window -v -c '#{pane_current_path}' -f
bind x kill-pane
bind X kill-window
bind w choose-tree -Z
bind W command-prompt 'rename-window %%'
bind S command-prompt 'rename-session %%'
bind s set synchronize-panes
@ -33,37 +31,31 @@ bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h select-pane -L
bind -r C-j select-pane -D
bind -r C-k select-pane -U
bind -r C-l select-pane -R
# Resize panes
bind -r Left resize-pane -L 1
bind -r Down resize-pane -D 1
bind -r Up resize-pane -U 1
bind -r Right resize-pane -R 1
bind -r S-Left resize-pane -L 10
bind -r S-Down resize-pane -D 10
bind -r S-Up resize-pane -U 10
bind -r S-Right resize-pane -R 10
bind -r C-h resize-pane -L 2
bind -r C-j resize-pane -D 2
bind -r C-k resize-pane -U 2
bind -r C-l resize-pane -R 2
# Arrangement of panes & windows
bind b break-pane -d
bind B break-pane
bind H join-pane -h -b \; select-pane -M
bind J join-pane -v \; select-pane -M
bind K join-pane -v -b \; select-pane -M
bind L join-pane -h \; select-pane -M
bind C-p swap-pane \; select-pane -M
bind b break-pane \; select-pane -m \; last-window
bind H join-pane -h -b
bind J join-pane -v
bind K join-pane -v -b
bind L join-pane -h
bind -r > swap-window -d -t :+
bind -r < swap-window -d -t :-
# Choosing layouts
bind -r C-y set main-pane-width 50% \; set main-pane-height 50% \; next-layout
bind -r C-o rotate-window -D
bind -r C-i rotate-window -U
bind -r space next-layout
bind C-m set main-pane-width 50% \; select-layout main-vertical
bind C-e select-layout even-horizontal
bind C-t select-layout tiled
# Copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection
@ -102,75 +94,32 @@ set-environment -gu SHLVL
#
# Style (status list, colors, ...)
#
set -g status-left ' ' # 󰄴 󰣕 󰬫 󰻃 󰪥 󰬪    󰡖 󰄱
set -g status-right '\
#[fg=brightblack] \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{pane_id}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{session_name}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{pid} @ #{host_short} '
setw -g window-status-current-format '\
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}#{window_index} \
#[bold]#[fg=blue]#{window_name}#[nobold] \
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}\
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
setw -g window-status-format '\
#{?client_prefix,#[fg=brightyellow],#{?window_last_flag,#[fg=cyan],#[fg=brightblack]}}\
#{window_index} \
#[fg=brightblack]#{window_name} \
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
set -g status-justify left
set -g status-style fg=white,bg=black
set -g pane-border-style fg=black
set -g pane-active-border-style fg=brightblue
set -g message-style fg=brightwhite,bg=black
set -g message-command-style fg=yellow,bg=black
set -g status-justify left
set -g status-left ""
set -g status-right-length 64
%hidden highlight="#b57614"
%hidden current_badge="#076678"
%hidden current_bg="#003848"
%hidden current_fg="#83a598"
%hidden window_badge="#665c54"
%hidden window_fg="#7c6f64"
%hidden flags="#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}"
%if "${TMUX_ROUNDED}"
%hidden background="#131516"
%hidden window_bg="#282828"
set -g status-style bg=${background}
setw -g window-status-format "\
#[fg=#{?client_prefix,${highlight},${window_badge}}]#[reverse]#{window_index} #[noreverse]\
#[fg=#{?window_last_flag,${current_fg},${window_fg}} bg=${window_bg}] #{window_name} ${flags}\
#[fg=${window_bg} bg=${background}] "
setw -g window-status-current-format "\
#[fg=#{?client_prefix,${highlight},${current_badge}}]#[reverse]#{window_index} #[noreverse]\
#[fg=${current_fg} bg=${current_bg}] #{window_name} ${flags}\
#[fg=${current_bg} bg=${background}] "
pill_begin="#[fg=#{?client_prefix,${highlight},${window_badge}}]#[reverse]"
pill_mid="#[noreverse]#[fg=${window_fg} bg=${window_bg}]"
pill_end="#[fg=${window_bg} bg=${background}]"
set -g status-right "\
${pill_begin}󰈷 ${pill_mid} #{pane_id}${pill_end} \
${pill_begin} ${pill_mid} #{session_name}${pill_end} \
${pill_begin} ${pill_mid} #{pid}${pill_end} \
${pill_begin}󱡶 ${pill_mid} #{host_short}${pill_end} "
%else
%hidden background="#1d2021"
set -g status-style bg=${background}
setw -g window-status-format "\
#[fg=${background} bg=#{?client_prefix,${highlight},${window_badge}} bold] #{window_index} \
#[fg=#{?window_last_flag,${current_fg},${window_fg}} bg=${background} nobold] #{window_name} ${flags}\
#[default] "
setw -g window-status-current-format "\
#[fg=${background} bg=#{?client_prefix,${highlight},${current_badge}} bold] #{window_index} \
#[fg=${current_fg} bg=${current_bg} nobold] #{window_name} ${flags}\
#[default] "
box_begin="#[fg=${background} bg=#{?client_prefix,${highlight},${window_badge}} bold] "
box_mid="#[fg=${window_fg} bg=${background} nobold]"
box_end="#[default]"
set -g status-right "\
${box_begin}󰈷 ${box_mid} #{pane_id} ${box_end} \
${box_begin} ${box_mid} #{session_name} ${box_end} \
${box_begin} ${box_mid} #{pid} ${box_end} \
${box_begin}󱡶 ${box_mid} #{host_short} ${box_end}"
%endif

View file

@ -2,8 +2,6 @@ BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
# AlignArrayOfStructures: Right
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveMacros: true
AllowShortBlocksOnASingleLine: Empty
@ -12,9 +10,9 @@ AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
# BreakBeforeBinaryOperators: NonAssignment # TODO: enable on clang-format v20
BreakBeforeBraces: WebKit
BreakBinaryOperations: OnePerLine
# BreakBinaryOperations: OnePerLine # TODO: enable on clang-format v20
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ContinuationIndentWidth: 8