Compare commits

..

2 commits
main ... lazy

Author SHA1 Message Date
52d730a5a2 vim/lsp: lazy load 2023-08-13 22:40:52 +02:00
e36bce4610 vim/completion: lazy load 2023-08-13 22:25:50 +02:00
176 changed files with 2672 additions and 5605 deletions

1
.gitattributes vendored
View file

@ -1 +1,2 @@
ssh/config filter=git-crypt diff=git-crypt

8
.gitignore vendored
View file

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

View file

@ -1,26 +0,0 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: end-of-file-fixer
exclude: ^config\/nvim\/lazy-lock\.json$
- id: trailing-whitespace
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: |
(?x)^(
config\/zsh\/.*|
home/\.zshenv
)$
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.20.0
hooks:
- id: stylua
args: [-f, config/nvim/stylua.toml]
files: ^config\/nvim\/.*lua$

View file

@ -16,8 +16,9 @@ Just `git rm unlock.sh ssh/config` and add your own.
## Prerequisites
[git-crypt] and [gpg] are needed to decrypt sensitive information in the
repository.
[git-crypt][] and [gpg][] are needed to decrypt sensitive information
in the repository.
[git-crypt]: https://github.com/AGWA/git-crypt
[gpg]: https://gnupg.org

View file

@ -24,3 +24,4 @@ cat <<EOF
37m  gYw  gYw   gYw   gYw   gYw   gYw   gYw   gYw   gYw 
1;37m  gYw  gYw   gYw   gYw   gYw   gYw   gYw   gYw   gYw 
EOF

View file

@ -22,6 +22,7 @@ bg_256() { printf '\e[48;5;%sm' "$1"; }
fg_rgb() { printf '\e[38;2;%s;%s;%sm' "$1" "$2" "$3"; }
bg_rgb() { printf '\e[48;2;%s;%s;%sm' "$1" "$2" "$3"; }
rgb_from_hex() {
echo "$1" | awk '{
r="0x"substr($0, 2, 2)
@ -40,53 +41,38 @@ reset() { printf '\e[0m'; }
fg_reset() { printf '\e[39m'; }
bg_reset() { printf '\e[49m'; }
indent() { printf ' '; }
indent() { printf ' '; }
newline() { printf '%b\n' '\e[0m'; }
indexed_16() {
echo "16 indexed colors:"
black=0
white=15
for i in 0 1; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
indent
for j in $(seq 0 7); do
n=$((8*i + j))
bg_16 "$n"; fg_16 "$fg"; printf ' %2d ' "$n"
bg_16 $((8*i + j)); printf '%4s' ''
done
newline
done
}
indexed_256() {
echo "256 indexed colors:"
black=232
white=255
# 16 standard colors
for i in 0 1; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
indent
for j in $(seq 0 7); do
n=$((8*i + j))
bg_256 "$n"; fg_256 "$fg"; printf ' %3d ' "$n"
bg_256 $((8*i + j)); printf '%9s' ''
done
newline
done
# 216 colors
for i in 0 18; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
for j in $(seq 0 5); do
indent
for k in $(seq $i $(( i + 17 ))); do
n=$((16 + 36*j + k))
bg_256 "$n"; fg_256 "$fg"; printf '%3d ' "$n"
bg_256 $((16 + 36*j + k)); printf '%4s' ''
done
newline
done
@ -95,10 +81,8 @@ indexed_256() {
# 24 grayscale colors
for i in 0 1; do
indent
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
for j in $(seq 0 11); do
n=$((232 + 12*i + j))
bg_256 "$n"; fg_256 "$fg"; printf ' %3d ' "$n"
bg_256 $((232 + 12*i + j)); printf '%6s' ''
done
newline
done
@ -146,14 +130,15 @@ main() {
indexed_16
echo
indexed_256
# echo
# gruvbox_dark
# echo
# gruvbox_light
# echo
# solarized
# echo
# nord
echo
gruvbox_dark
echo
gruvbox_light
echo
solarized
echo
nord
}
main

37
bin/colors256 Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
# Print all 256 colors
black="\e[38;5;232m"
white="\e[38;5;255m"
# 16 standard colors -> 0...15
for i in $(seq 0 15); do
[ $i -lt 8 ] && fg="$white" || fg="$black"
bg="\e[48;5;${i}m"
printf '%b%b %2d ' "$fg" "$bg" "$i"
done
printf '%b\n' '\e[0m'
# 216 colors -> 16...231
for i in $(seq 0 5); do
for j in $(seq 0 35); do
n=$(( 16 + 36 * i + j ))
[ $j -lt 18 ] && fg="$white" || fg="$black"
bg="\e[48;5;${n}m"
printf '%b%b%4d' "$fg" "$bg" "$n"
done
printf '%b\n' '\e[0m'
done
# 24 grayscale colors -> 232...255
for i in $(seq 0 23); do
n=$(( 232 + i ))
[ $i -lt 12 ] && fg="$white" || fg="$black"
bg="\e[48;5;${n}m"
printf '%b%b%4d ' "$fg" "$bg" "$n"
done
printf '%b\n' '\e[0m'

View file

@ -16,3 +16,4 @@ BEGIN {
}
printf "\n";
}

View file

@ -1,2 +1,3 @@
#!/bin/sh
env | sort | grep --color=always '=.*$'

View file

@ -1,8 +0,0 @@
#!/bin/sh
#
# List git aliases.
#
exec git config --get-regexp '^alias' \
| sed 's/^alias\.//' \
| sed 's/ /\t= /' \
| sort

View file

@ -1,8 +0,0 @@
#!/bin/sh
#
# List authors in the repository.
#
exec git shortlog --email --numbered --summary "$@" \
| awk '{$1=""; sub(" ", ""); print}' \
| awk -F'<' '!seen[$1]++' \
| awk -F'<' '!seen[$2]++'

View file

@ -1,516 +0,0 @@
#!/usr/bin/perl
#
# Github like contributions calendar on terminal.
#
# Source: https://github.com/k4rthik/git-cal
#
use strict;
use warnings;
use utf8;
use Getopt::Long;
use Pod::Usage;
use Time::Local;
use Data::Dumper;
binmode(STDOUT, ":utf8");
#command line options
my ( $help, $period, $use_ascii, $use_ansi, $use_unicode, $format, $author, $filepath, $all_branches );
GetOptions(
'help|?' => \$help,
'period|p=n' => \$period,
'ascii' => \$use_ascii,
'ansi' => \$use_ansi,
'unicode' => \$use_unicode,
'author=s' => \$author,
'all' => \$all_branches
) or pod2usage(2);
pod2usage(1) if $help;
$filepath = shift @ARGV;
# also tried to use unicode chars instead of colors, the exp did not go well
#qw(⬚ ⬜ ▤ ▣ ⬛)
#qw(⬚ ▢ ▤ ▣ ⬛)
my @unicode = qw(⬚ ▢ ▤ ▣ ⬛);
# my @colors = ( 237, 139, 40, 190, 1 ); original
my @colors = ( 235, 58, 64, 70, 82 );
my @ascii = ( " ", ".", "o", "O", "0" );
my @months = qw (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
configure(\$period, \$use_ascii, \$use_ansi, \$use_unicode, \$author);
process();
# 53 X 7 grid
# consists of 0 - 370 blocks
my ( @grid, @timeline, %pos_month, %month_pos, $jan1, $cur_year, $max_epoch, $min_epoch, $max_commits, $q1, $q2, $q3 );
my ( $first_block, $last_block, $start_block, $end_block, $row_start, $row_end );
#loads of global variables
sub process {
$format
= $use_ansi ? 'ansi'
: $use_ascii ? 'ascii'
: $use_unicode ? 'unicode'
: undef;
#if the user decided not to choose the format, let's pick some environmentally smart format
if ( !defined $format ) {
$format
= $ENV{EMACS} ? 'unicode'
: $ENV{TERM} eq 'dumb' ? 'ascii'
: 'ansi';
}
init_cal_stuff();
process_current_repo();
my %stats = compute_stats();
print_grid(%stats);
}
sub process_current_repo {
my $git_command = git_command();
my @epochs = qx/$git_command/;
if ($?) {
print "fatal: git-cal failed to get the git log\n";
exit(2);
}
if ( !@epochs ) {
print "git-cal: got empty log, nothing to do\n";
exit(1);
}
my $status;
foreach (@epochs) {
$status = add_epoch($_);
last if !$status;
}
}
sub git_command {
my $command = qq{git log --no-merges --pretty=format:"%at" --since="13 months"};
$command .= qq{ --author="$author"} if $author;
$command .= qq{ --all } if $all_branches;
if ($filepath) {
if ( -e $filepath ) {
$command .= qq{ -- $filepath};
}
else {
print "fatal: $filepath: no such file or directory\n";
exit(2);
}
}
return $command;
}
sub init_cal_stuff {
my ( $wday, $yday, $month, $year ) = ( localtime(time) )[ 6, 7, 4, 5 ];
$cur_year = $year;
$jan1 = 370 - ( $yday + 6 - $wday );
$last_block = $jan1 + $yday + 1;
$first_block = $last_block - 365;
$max_commits = 0;
push @timeline, $jan1;
$month_pos{0} = $jan1;
my $cur = $jan1;
foreach ( 0 .. $month - 1 ) {
$cur += number_of_days( $_, $year );
push @timeline, $cur;
$month_pos{ $_ + 1 } = $cur;
}
$cur = $jan1;
for ( my $m = 11; $m > $month; $m-- ) {
$cur -= number_of_days( $m, $year - 1 );
unshift @timeline, $cur;
$month_pos{$m} = $cur;
}
$pos_month{ $month_pos{$_} } = $months[$_] foreach keys %month_pos;
die "period can only be between -11 to 0 and 1 to 12" if ( defined $period && ( $period < -11 || $period > 12 ) );
if ( !defined $period ) {
$start_block = $first_block;
$end_block = $last_block;
}
elsif ( $period > 0 ) {
$start_block = $month_pos{ $period - 1 };
$end_block = $month_pos{ $period % 12 };
$end_block = $last_block if $start_block > $end_block;
}
else {
$start_block = $timeline[ 11 + $period ];
$start_block = $first_block if $period == -12;
$end_block = $last_block;
}
$row_start = int $start_block / 7;
$row_end = int $end_block / 7;
$max_epoch = time - 86400 * ( $last_block - $end_block );
$min_epoch = time - 86400 * ( $last_block - $start_block );
}
sub add_epoch {
my ($epoch, $count) = @_;
if ( $epoch > $max_epoch || $epoch < $min_epoch ) {
return 1;
}
my ( $month, $year, $wday, $yday ) = ( localtime($epoch) )[ 4, 5, 6, 7 ];
my $pos;
if ( $year == $cur_year ) {
$pos = ( $jan1 + $yday );
}
else {
my $total = ( $year % 4 ) ? 365 : 366;
$pos = ( $jan1 - ( $total - $yday ) );
}
return 0 if $pos < 0; #just in case
add_to_grid( $pos, $epoch, $count );
return 1;
}
sub add_to_grid {
my ( $pos, $epoch, $count ) = @_;
$count ||= 1;
my $r = int $pos / 7;
my $c = $pos % 7;
$grid[$r][$c]->{commits}+=$count;
$grid[$r][$c]->{epoch} = $epoch;
$max_commits = $grid[$r][$c]->{commits} if $grid[$r][$c]->{commits} > $max_commits;
}
sub compute_stats {
my %commit_counts;
my (
$total_commits,
$cur_streak,
$cur_start,
$max_streak,
$max_start,
$max_end,
$cur_streak_weekdays,
$cur_weekdays_start,
$max_streak_weekdays,
$max_weekdays_start,
$max_weekdays_end,
$q1,
$q2,
$q3,
) = (0) x 14;
foreach my $r ( $row_start .. $row_end ) {
foreach my $c ( 0 .. 6 ) {
my $cur_block = ( $r * 7 ) + $c;
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
my $count = $grid[$r][$c]->{commits} || 0;
$total_commits += $count;
if ($count) {
$commit_counts{$count} = 1;
$cur_streak++;
$cur_start ||= $grid[$r][$c]->{epoch};
if ( $cur_streak > $max_streak ) {
$max_streak = $cur_streak;
$max_start = $cur_start;
$max_end = $grid[$r][$c]->{epoch};
}
#count++ if you work on weekends and streak will not be broken otherwise :)
$cur_streak_weekdays++;
$cur_weekdays_start ||= $grid[$r][$c]->{epoch};
if ( $cur_streak_weekdays > $max_streak_weekdays ) {
$max_streak_weekdays = $cur_streak_weekdays;
$max_weekdays_start = $cur_weekdays_start;
$max_weekdays_end = $grid[$r][$c]->{epoch};
}
}
else {
$cur_streak = 0;
$cur_start = 0;
if ( $c > 0 && $c < 6 ) {
$cur_streak_weekdays = 0;
$cur_weekdays_start = 0;
}
}
}
}
}
#now compute quartiles
my @commit_counts = sort { $a <=> $b } ( keys %commit_counts );
$q1 = $commit_counts[ int( scalar @commit_counts ) / 4 ];
$q2 = $commit_counts[ int( scalar @commit_counts ) / 2 ];
$q3 = $commit_counts[ int( 3 * ( scalar @commit_counts ) / 4 ) ];
#print "commit counts: " . (scalar @commit_counts) . " - " . (join ",",@commit_counts) . "\n\n";
#print "quartiles: $q1 $q2 $q3\n";
#die Dumper \%stat;
my %stat = (
total_commits => $total_commits,
cur_streak => $cur_streak ,
cur_start => $cur_start ,
max_streak => $max_streak ,
max_start => $max_start ,
max_end => $max_end ,
cur_streak_weekdays => $cur_streak_weekdays,
cur_weekdays_start => $cur_weekdays_start,
max_streak_weekdays => $max_streak_weekdays,
max_weekdays_start => $max_weekdays_start,
max_weekdays_end => $max_weekdays_end ,
q1 => $q1,
q2 => $q2,
q3 => $q3,
);
return %stat;
}
sub print_grid {
my %stat = @_;
my $space = 6;
print_month_names($space);
foreach my $c ( 0 .. 6 ) {
printf "\n%" . ( $space - 2 ) . "s", "";
print $c == 1 ? "M "
: $c == 3 ? "W "
: $c == 5 ? "F "
: " ";
foreach my $r ( $row_start .. $row_end ) {
my $cur_block = ( $r * 7 ) + $c;
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
my $val = $grid[$r][$c]->{commits} || 0;
my $index = $val == 0 ? 0
: $val <= $stat{q1} ? 1
: $val <= $stat{q2} ? 2
: $val <= $stat{q3} ? 3
: 4;
print_block($index);
}
else {
print " ";
}
}
}
print "\n\n";
printf " %d total commits\t\t\tLess ", $stat{total_commits};
print_block($_) foreach ( 0 .. 4 );
printf " More\n\n";
}
sub print_block {
my $index = shift;
$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";
print;
}
sub print_month_names {
#print month labels, printing current month in the right position is tricky
my $space = shift;
if ( defined $period && $period > 0 ) {
printf "%" . $space . "s %3s", "", $months[ $period - 1 ];
return;
}
my $label_printer = 0;
my $timeline_iter = defined $period ? 11 + $period : 0;
if ( $start_block == $first_block && $timeline[0] != 0 ) {
my $first_pos = int $timeline[0] / 7;
if ( $first_pos == 0 ) {
printf "%" . ( $space - 2 ) . "s", "";
print $pos_month{ $timeline[-1] } . " ";
print $pos_month{ $timeline[0] } . " ";
$timeline_iter++;
}
elsif ( $first_pos == 1 ) {
printf "%" . ( $space - 2 ) . "s", "";
print $pos_month{ $timeline[-1] } . " ";
}
else {
printf "%" . $space . "s", "";
printf "%-" . ( 2 * $first_pos ) . "s", $pos_month{ $timeline[-1] };
}
$label_printer = $first_pos;
}
else {
printf "%" . $space . "s", "";
$label_printer += ( int $start_block / 7 );
}
while ( $label_printer < $end_block / 7 && $timeline_iter <= $#timeline ) {
while ( ( int $timeline[$timeline_iter] / 7 ) != $label_printer ) { print " "; $label_printer++; }
print " " . $pos_month{ $timeline[$timeline_iter] } . " ";
$label_printer += 3;
$timeline_iter++;
}
}
sub print_message {
my ( $days, $start_epoch, $end_epoch, $message ) = @_;
if ($days) {
my @range;
foreach my $epoch ( $start_epoch, $end_epoch ) {
my ( $mday, $mon, $year ) = ( localtime($epoch) )[ 3, 4, 5 ];
my $s = sprintf( "%3s %2d %4d", $months[$mon], $mday, ( 1900 + $year ) );
push @range, $s;
}
printf "%4d: Days ( %-25s ) - %-40s\n", $days, ( join " - ", @range ), $message;
}
else {
printf "%4d: Days - %-40s\n", $days, $message;
}
}
sub number_of_days {
my ( $month, $year ) = @_;
return 30 if $month == 3 || $month == 5 || $month == 8 || $month == 10;
return 31 if $month != 1;
return 28 if $year % 4;
return 29;
}
sub configure {
my ($period, $ascii, $ansi, $unicode, $author) = @_;
my @wanted;
push @wanted, 'format' if (not grep { defined $$_ } ($ascii, $ansi, $unicode));
push @wanted, 'period' if (not defined $$period);
push @wanted, 'author' if (not defined $$author);
if (@wanted) {
my $git_command = "git config --get-regexp 'calendar\.*'";
my @parts = split(/\s/, qx/$git_command/);
if(@parts) {
my %config;
while(my ($key, $value) = splice(@parts, 0, 2)) {
$key =~ s/calendar\.//;
$config{$key} = $value;
}
local @ARGV = (map { ( "-$_" => $config{$_} ) }
grep { exists $config{$_} } @wanted);
GetOptions(
'period=n' => $period,
'format=s' => sub {
if ($_[1] eq 'ascii') { $$ascii ||= 1; }
elsif ($_[1] eq 'ansi') { $$ansi ||= 1; }
elsif ($_[1] eq 'unicode') { $$unicode ||= 1; }
},
'author=s' => $author
);
}
}
}
__END__
=head1 NAME
git-cal - A simple tool to view commits calendar (similar to github contributions calendar) on command line
=head1 SYNOPSIS
"git-cal" is a tool to visualize the git commit history in github's contribution calendar style.
The calendar shows how frequently the commits are made over the past year or some choosen period
Activity can be displayed using ascii, ansi or unicode characters, default is choosen based on ENV
git-cal
git-cal --period=<1..12, -11..0>
git-cal --author=<author>
git-cal --ascii
git-cal --ansi
git-cal --unicode
git-cal <options> <filepath>
=head2 OPTIONS
=over
=item [--period|-p]=<n>
Do not show the entire year:
=over
=item n = 1 to 12
Shows only one month (1=Jan .. 12=Dec)
=item n = -11 to 0
Shows the previous -n months (and the current month)
=back
=item --author=<author>
View commits of a particular author.
=item --all
View stats from all branches.
=item --ascii
Display activity using ASCII characters instead of ANSI colors.
=item --ansi
Display activity using ANSI colors
=item --unicode
Display activity using unicode characters
=item --help|-?
Print this message.
=back
=head2 ADDITIONAL OPTIONS
<filepath> to view the logs of a particular file or directory
=head2 USING GIT CONFIG
git-cal uses the git config tool to store configuration on disk. Similar keys are used to
those listed above with the notable exception being the bundling of ascii, ansi and unicode
into a "format" key. Examples of the three supported keys are below.
git config --global calendar.format ascii
git config --global calendar.period 5
git config --global calendar.author karthik
A command line supplied option will override the matching option set using this method.
=head1 AUTHOR
Karthik katooru <karthikkatooru@gmail.com>
=head1 COPYRIGHT AND LICENSE
This program is free software; you can redistribute it and/or modify it under the MIT License

View file

@ -1,8 +1,10 @@
#!/bin/sh
#!/bin/bash
#
# List files with commit count.
# Written by Corey Haines
# Scriptified by Gary Bernhardt
#
# Based on: https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git churn`.
#
# Show churn for whole repo:
# $ git churn
@ -14,15 +16,8 @@
# $ git churn --since='1 month ago'
#
# (These are all standard arguments to `git log`.)
#
exec git log --all \
--find-copies \
--find-renames \
--name-only \
--format='format:' \
"$@" \
| sort \
| grep -v '^$' \
| uniq -c \
| sort -n \
| awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'
set -e
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'

View file

@ -1,26 +0,0 @@
#!/bin/sh
set -eu
WORKDIR="${XDG_CACHE_HOME:-$HOME/.cache}/git-ignore"
URL="https://github.com/github/gitignore.git"
if [ ! -d "$WORKDIR" ]; then
git clone --quiet --depth 1 "$URL" "$WORKDIR"
else
git -C "$WORKDIR" pull --quiet
fi
find "$WORKDIR" -maxdepth 1 -type f -name '*gitignore' |
sed -e "s,^$WORKDIR/\(.*\)\.gitignore$,\1," |
sort |
fzf --multi \
--preview="cat $WORKDIR/{}.gitignore" \
--bind='ctrl-p:toggle-preview' |
while read -r lang; do
echo "############################################################"
echo "# ${lang}"
echo "############################################################"
cat "$WORKDIR/${lang}.gitignore"
echo
done

View file

@ -1,5 +0,0 @@
#!/bin/sh
#
# List ignored files.
#
exec git ls-files --ignored --exclude-standard --others

View file

@ -1,8 +0,0 @@
#!/bin/sh
#
# Initialize a git repository and automatically create an empty root commit.
#
set -e
git init
git commit --allow-empty -m "Initial commit"
git log --graph --pretty='%C(auto)%h%d %s %C(8) %ad'

View file

@ -1,9 +0,0 @@
#!/bin/sh
#
# Show a simplified tree with all branches.
#
exec git log \
--all \
--graph \
--pretty='%C(auto)%h%d %s %C(8) %ad' \
--simplify-by-decoration

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

@ -1,3 +1,4 @@
#!/bin/sh
# Head as much as fits on screen
exec head -n "$(echo "$(tput lines) - 5" | bc)" "$@"
exec head -n $(echo "$(tput lines) - 5" | bc) "$@"

View file

@ -9,7 +9,6 @@ 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
@ -17,3 +16,4 @@ base64 -d <<EOF | gpg -d
%s
EOF
' "$(gpg -c --cipher-algo AES256 -o - -- "$1" | base64)"

View file

@ -1,2 +1,3 @@
#!/bin/sh
echo "$MANPATH" | tr -s ":" "\n"

View file

@ -6,3 +6,4 @@
exec curl -s https://ifconfig.co
#exec curl -s https://ifconfig.me
#exec dig +short myip.opendns.com @resolver1.opendns.com

View file

@ -1,2 +1,3 @@
#!/bin/sh
exec curl -s ipinfo.io

View file

@ -2,7 +2,7 @@
usage() {
echo "Usage:
$(basename "$0") [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
$(basename $0) [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
where:
-h print this help
@ -32,3 +32,4 @@ case "$1" in
"") error "volume required" ;;
*) gen_fstab_entry "$1";;
esac

View file

@ -1,2 +1,3 @@
#!/bin/sh
echo "$PATH" | tr -s ":" "\n"

View file

@ -11,3 +11,4 @@ printf '%b\n' "\e[7mThis text has the reverse (tput rev) attribute.${reset}"
printf '%b\n' "\e[8mThis text has the invisible (tput invis) attribute.${reset}"
printf '%b\n' "\e[9mThis text has the strikethrough (tput ?) attribute.${reset}"
printf '%b\n' "\e[21mThis text has the double underline (tput ?) attribute.${reset}"

View file

@ -1,3 +1,4 @@
#!/bin/sh
# Tail as much as fits on screen
exec tail -n "$(echo "$(tput lines) - 5" | bc)" "$@"
exec tail -n $(echo "$(tput lines) - 5" | bc) "$@"

View file

@ -108,3 +108,4 @@ if __name__ == '__main__':
generate = generators[args.terminal]
print(generate(SOLARIZED, **theme))

View file

@ -1,6 +1,6 @@
#!/bin/bash
scriptname=$(basename "$0")
scriptname=`basename "$0"`
usage() {
echo "Usage: $scriptname SHARE [...]"
@ -15,7 +15,7 @@ mount_share() {
share="$1"
sudo mkdir "/mnt/$share"
sudo chmod 777 "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid="$(id -g)" "$share" "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) "$share" "/mnt/$share"
}
main() {
@ -30,3 +30,4 @@ main() {
}
main "$@"

7
config.def.sh Normal file
View file

@ -0,0 +1,7 @@
# Where to install the dotfiles, usually $HOME.
DESTDIR="$HOME"
# Git user information.
GIT_USER="Fernando Schauenburg"
GIT_EMAIL="dev@schauenburg.me"

View file

@ -1,4 +1,5 @@
[alias]
alias = config --get-regexp ^alias
b = branch
bv = b -vv
ba = bv --all
@ -15,13 +16,12 @@
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
[pretty]
basic = %C(auto)%h%d %s %C(8) %ad
name = %C(auto)%h%d %s %C(2)%aN <%C(10)%aE%C(2)> %C(8) %ad
name = %C(auto)%h%d %s %n%C(2)%aN <%C(10)%aE%C(2)> %C(8) %ad %n
[core]
excludesfile = ~/.config/git/ignore
@ -35,16 +35,25 @@
date = human
[delta]
features = gruvbox
commit-decoration-style = "#d79921" bold box ul
commit-style = raw
dark = true
file-decoration-style = "#458588" bold box
file-modified-label = "modified:"
file-style = "#458588" # blue
hunk-header-style = omit
line-numbers = true
line-numbers-minus-style = "#cc241d" italic # red
line-numbers-plus-style = "#98971a" italic # green
line-numbers-zero-style = "#504945" # dark2
line-numbers-left-style = "#665c54" # dark3
line-numbers-right-style = "#ebdbb2" # light1
minus-emph-style = normal "#651e1b" # red almost darkest
minus-style = normal "#2e100f" # red darkest
plus-emph-style = syntax "#585818" # green almost darkest
plus-style = syntax "#2e2e0f" # green darkest
syntax-theme = Nord
[include]
path = delta.gitconfig
[push]
default = upstream
@ -67,7 +76,6 @@
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# Color palette translation:
@ -108,8 +116,8 @@
path = ~/.local/etc/git/config.user # user name & e-mail (from template)
path = ~/.local/etc/git/config # optional manual configurations
# Never commit my dotfiles or personal projects with the wrong e-mail address.
# Overrides for my dotfiles directory to make sure I never commit with the
# wrong e-mail address.
[includeIf "gitdir:~/.dotfiles/"]
path = ~/.config/git/dev@schauenburg.me
[includeIf "gitdir:~/.local/src/"]
path = ~/.config/git/dev@schauenburg.me
path = ~/.config/git/dotfiles

View file

@ -1,43 +0,0 @@
[delta "gruvbox"]
dark = true
commit-decoration-style = "#d79921" bold box ul
file-decoration-style = "#458588" bold box
file-style = "#458588"
line-numbers-minus-style = "#cc241d" bold italic
line-numbers-plus-style = "#98971a" bold italic
line-numbers-zero-style = "#504945"
line-numbers-left-style = "#665c54"
line-numbers-right-style = "#ebdbb2"
minus-empty-line-marker-style = syntax "#2e100f"
minus-non-emph-style = syntax "#2e100f"
minus-emph-style = syntax "#651e1b"
minus-style = syntax "#2e100f"
plus-empty-line-marker-style = syntax "#2e2e0f"
plus-non-emph-style = syntax "#2e2e0f"
plus-emph-style = syntax "#585818"
plus-style = syntax "#2e2e0f"
[delta "tokyonight"]
dark = true
commit-decoration-style = "#e0af68" bold box ul
file-decoration-style = "#769def" bold box
file-style = "#769def"
line-numbers-minus-style = "#b2555b" bold italic
line-numbers-plus-style = "#266d6a" bold italic
line-numbers-zero-style = "#3b4261"
line-numbers-left-style = "#414868"
line-numbers-right-style = "#a9b1d6"
minus-empty-line-marker-style = syntax "#37222c"
minus-non-emph-style = syntax "#37222c"
minus-emph-style = syntax "#713137"
minus-style = syntax "#37222c"
plus-empty-line-marker-style = syntax "#20303b"
plus-non-emph-style = syntax "#20303b"
plus-emph-style = syntax "#2c5a66"
plus-style = syntax "#20303b"

View file

@ -1,3 +1,4 @@
[user]
name = Fernando Schauenburg
email = dev@schauenburg.me

View file

@ -1,25 +1,19 @@
AllowBlinking=yes
BellType=0
BoldAsColour=no
BoldAsFont=yes
Charset=UTF-8
Columns=110
Columns=130
CtrlAltIsAltGr=yes
CursorType=line
Font=SauceCodePro NF Medium
FontHeight=11
FontSmoothing=default
FontWeight=500
Font=Source Code Pro Medium
FontHeight=9
FontWeight=400
Hold=error
Locale=en_US
OpaqueWhenFocused=yes
Padding=0
RewrapOnResize=no
Rows=45
Rows=64
Scrollbar=none
SelectionShowSize=6
StatusLine=no
Term=xterm-256color
ThemeFile=gruvbox-dark
Transparency=off
Transparency=low
Utmp=yes
ThemeFile=solarized-dark

View file

@ -1,31 +0,0 @@
# 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
Black = 40, 40, 40
Red = 204, 36, 29
Green = 152, 151, 26
Yellow = 215, 153, 33
Blue = 69, 133, 136
Magenta = 177, 98, 134
Cyan = 104, 157, 106
White = 235, 219, 178
BoldBlack = 146, 131, 116
BoldRed = 251, 73, 52
BoldGreen = 184, 187, 38
BoldYellow = 250, 189, 47
BoldBlue = 131, 165, 152
BoldMagenta = 211, 134, 155
BoldCyan = 142, 192, 124
BoldWhite = 251, 241, 199

View file

@ -1,7 +1,7 @@
# Solarized Dark
ForegroundColour=131,148,150
BackgroundColour=0,32,40
BackgroundColour=0,43,54
CursorColour=220,50,47
Black=7,54,66

View file

@ -1,24 +0,0 @@
# Tokyonight Night
ForegroundColour = #c0caf5
BackgroundColour = #1a1b26
CursorColour = #FB567A
IMECursorColour = #F7768E
Black = #15161E
Red = #F86D8B
Green = #9ECE6A
Yellow = #E0AF68
Blue = #5588F6
Magenta = #8E57F4
Cyan = #61B8EA
White = #A9B1D6
BoldBlack = #414868
BoldRed = #F7768E
BoldGreen = #A8DB70
BoldYellow = #EFB45D
BoldBlue = #7AA2F7
BoldMagenta = #BB9AF7
BoldCyan = #7DCFFF
BoldWhite = #C0CAF5

View file

@ -1,24 +0,0 @@
# Tokyonight Night
ForegroundColour = #c0caf5
BackgroundColour = #1a1b26
CursorColour = #f7768e
IMECursorColour = #f7768e
Black = #15161e
Red = #f7768e
Green = #9ece6a
Yellow = #e0af68
Blue = #7aa2f7
Magenta = #bb9af7
Cyan = #7dcfff
White = #a9b1d6
BoldBlack = #414868
BoldRed = #f7768e
BoldGreen = #9ece6a
BoldYellow = #e0af68
BoldBlue = #7aa2f7
BoldMagenta = #bb9af7
BoldCyan = #7dcfff
BoldWhite = #c0caf5

View file

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

View file

@ -1 +0,0 @@
vim.opt.spell = false

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 +0,0 @@
vim.bo.tabstop = 2

View file

@ -1 +0,0 @@
vim.bo.commentstring = "// %s"

View file

@ -1 +0,0 @@
vim.bo.commentstring = "// %s"

View file

@ -1 +0,0 @@
vim.bo.commentstring = "# %s"

View file

@ -1 +1,4 @@
require("util.options").set_gitcommit_buffer_options()
vim.bo.textwidth = 72
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking

View file

@ -1,18 +1,22 @@
vim.bo.tabstop = 2
local lua = require("util.lua")
local map = vim.keymap.set
local opts = function(desc) return { desc = desc, buffer = true, silent = true } end
local buffer = { buffer = true }
-- stylua: ignore start
map("n", "gf", lua.go_to_module, opts("Go to module under cursor"))
local exec_current_lua_line = function()
local lineno = vim.fn.line('.')
print('Executing line ' .. lineno)
vim.fn.luaeval(vim.fn.getline(lineno))
end
map("n", "<localleader>x", lua.execute_lines, opts("Execute current line"))
map("x", "<localleader>x", lua.execute_selection, opts("Execute selection"))
map("n", "<localleader><localleader>x", lua.execute_file, opts("Execute current file"))
local exec_current_lua_selection = function()
local selection = { vim.fn.line('v'), vim.fn.line('.') }
local first, last = vim.fn.min(selection), vim.fn.max(selection)
local code = vim.fn.join(vim.fn.getline(first, last), '\n')
print('Executing lines ' .. first .. ' to ' .. last)
loadstring(code)()
end
vim.keymap.set('n', '<localleader>x', exec_current_lua_line, buffer)
vim.keymap.set('x', '<localleader>x', exec_current_lua_selection, buffer)
vim.keymap.set('n', '<localleader><localleader>x', '<cmd>write | luafile %<cr>', buffer)
map("n", [[<localleader>']], [[:.s/"/'/g | nohl<cr>]], opts([[Replace: " 󱦰 ']]))
map("n", [[<localleader>"]], [[:.s/'/"/g | nohl<cr>]], opts([[Replace: ' 󱦰 "]]))
map("x", [[<localleader>']], [[:s/"/'/g | nohl<cr>]], opts([[Replace: " 󱦰 ']]))
map("x", [[<localleader>"]], [[:s/'/"/g | nohl<cr>]], opts([[Replace: ' 󱦰 "]]))
-- stylua: ignore end

View file

@ -1,4 +1,4 @@
vim.bo.tabstop = 2
vim.bo.shiftwidth = 0 -- use 'tabstop' for indenting
vim.opt.formatoptions:append("t") -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking

View file

@ -1,2 +0,0 @@
vim.bo.commentstring = "' %s"
vim.bo.tabstop = 2

View file

@ -1,2 +1,3 @@
vim.opt.foldmethod = "indent"
vim.opt.foldignore = "#"
vim.opt.foldmethod = 'indent'
vim.opt.foldignore = '#'

View file

@ -1 +0,0 @@
vim.opt.spell = false

View file

@ -1 +1,2 @@
vim.opt.tabstop = 2

View file

@ -1,2 +1,3 @@
vim.opt.formatoptions:append("t") -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking

View file

@ -1 +1,2 @@
vim.opt.foldmethod = "marker"
vim.opt.foldmethod = 'marker'

View file

@ -1 +0,0 @@
vim.bo.tabstop = 2

View file

@ -1,2 +1,2 @@
vim.opt.tabstop = 2
vim.opt.iskeyword:append("-")

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,2 @@
if vim.loader then vim.loader.enable() end
require('fschauen').setup()
require("config")

View file

@ -1,61 +0,0 @@
{
"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" },
"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" },
"fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"git-messenger.vim": { "branch": "master", "commit": "fd124457378a295a5d1036af4954b35d6b807385" },
"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" },
"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" },
"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-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" },
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
"plantuml-previewer.vim": { "branch": "master", "commit": "368a1f331c1ff29f6a3ee76facfca39a7f374b13" },
"plantuml-syntax": { "branch": "master", "commit": "9d4900aa16674bf5bb8296a72b975317d573b547" },
"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" },
"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" }
}

View file

@ -1,28 +0,0 @@
local M = {}
M.setup = function()
local group = vim.api.nvim_create_augroup("custom", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Briefly highlight yanked text.",
group = group,
pattern = "*",
callback = function(_) vim.highlight.on_yank() end,
})
vim.api.nvim_create_autocmd("InsertEnter", {
desc = "Hide cursor line when entering insert mode.",
group = group,
pattern = "*",
callback = function(_) vim.opt.cursorlineopt = "number" end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
desc = "Show cursor line when leaving insert mode.",
group = group,
pattern = "*",
callback = function(_) vim.opt.cursorlineopt = "both" end,
})
end
return M

View file

@ -1,140 +0,0 @@
local M = {}
---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
---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)
else
vim.diagnostic.enable(true, filter)
end
end
---Hide currently displayed diagnostics.
---@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")
---Use `Telescope` to set a new diagnostic severity.
M.set_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 {
separator = "",
items = { { width = 3 }, { 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" },
{ entry.value.icon, entry.value.highlight },
{ entry.value.title, entry.value.highlight },
}
end
local opts = require("telescope.themes").get_dropdown()
require("telescope.pickers")
.new(opts, {
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,
icon = icons.diagnostics_bold.Error,
highlight = "DiagnosticError",
},
{
title = "Warning",
severity = vim.diagnostic.severity.WARN,
icon = icons.diagnostics_bold.Warn,
highlight = "DiagnosticWarn",
},
{
title = "Info",
severity = vim.diagnostic.severity.INFO,
icon = icons.diagnostics_bold.Info,
highlight = "DiagnosticInfo",
},
{
title = "Hint",
severity = vim.diagnostic.severity.HINT,
icon = icons.diagnostics_bold.Hint,
highlight = "DiagnosticHint",
},
},
entry_maker = function(entry)
return { value = entry, ordinal = entry.title, display = make_display }
end,
},
sorter = require("telescope.config").values.generic_sorter(opts),
attach_mappings = function(prompt_bufnr)
require("telescope.actions.set").select:replace(function()
local selection = require("telescope.actions.state").get_selected_entry()
require("telescope.actions").close(prompt_bufnr)
M.setup { severity = { min = selection.value.severity } }
end)
return true -- Attach default mappings as well.
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,
},
})
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,
},
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,
},
}
end
return M

View file

@ -1,26 +0,0 @@
local M = {}
M.setup = function()
vim.filetype.add {
-- 1. The file path/name is checked first.
filename = {
["clang-format"] = "yaml",
editorconfig = "editorconfig",
},
-- 2. Patterns are checked second.
pattern = {
["${HOME}/.ssh/config.d/.*"] = "sshconfig",
-- Files in my dotfiles repository.
[".*/config/zsh/.*"] = "zsh",
[".*/git/config"] = "gitconfig",
[".*/ssh/config"] = "sshconfig",
},
-- 3. Finally, the extension is checked.
extension = {
gitconfig = "gitconfig",
},
}
end
return M

View file

@ -1,19 +0,0 @@
P = function(v)
print(vim.inspect(v))
return v
end
R = function(module)
require("plenary.reload").reload_module(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()
local colorscheme = vim.env.NVIM_COLORSCHEME or "gruvbox"
vim.cmd("silent! colorscheme " .. colorscheme)

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,64 +0,0 @@
local M = {}
local bootstrap = function(path)
if not vim.uv.fs_stat(path) then
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
"https://github.com/folke/lazy.nvim.git",
path,
}
end
vim.opt.rtp:prepend(path)
return vim.F.npcall(require, "lazy")
end
local dev_path = function()
local paths = {
"~/Projects/nvim-plugins",
"~/.local/src",
}
paths = vim.tbl_map(vim.fn.expand, paths)
paths = vim.tbl_filter(vim.uv.fs_stat, paths)
return paths[1]
end
M.setup = function()
local lazy = bootstrap(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
if not lazy then
vim.notify("Lazy not installed and failed to bootstrap!", vim.log.levels.WARN)
return
end
lazy.setup {
spec = "config.plugins",
dev = {
path = dev_path(),
fallback = true,
},
ui = {
border = "rounded",
title = " Lazy ",
},
change_detection = {
enabled = false,
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
}
end
return M

View file

@ -1,163 +0,0 @@
local M = {}
-- stylua: ignore start
M.setup = function()
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.cmd [[let &t_8f = "\<ESC>[38:2:%lu:%lu:%lum"]]
vim.cmd [[let &t_8b = "\<ESC>[48:2:%lu:%lu:%lum"]]
local o = vim.opt
-- Use `rg` for :grep if installed.
if vim.fn.executable("rg") == 1 then
o.grepprg = "rg --vimgrep --no-heading --smart-case"
o.grepformat = "%f:%l:%c:%m,%f:%l:%m"
end
-- General
o.belloff = "all" -- never ring bells
o.hidden = true -- hide abandoned buffers
o.lazyredraw = true -- don"t redraw screen during macros
o.modelines = 0 -- never use modelines
o.fileformats = "unix,mac,dos" -- prioritize unix <EOL> format
o.winblend = 8 -- minimum transparency for floating windows
o.swapfile = false -- don"t use swap files
o.writebackup = true -- Make a backup before writing a file...
o.backup = false -- ...but don"t keep it around.
o.undofile = true -- write undo history
o.shortmess:append("I") -- no intro message when starting Vim
o.shada = {
"'1000", -- remember marks for this many files
"/1000", -- remember this many search patterns
":1000", -- remember this many command line items
"<100", -- maximum number of lines to remember per register
"h", -- disable 'hlsearch' while reading shada file
"s100", -- limit size of remembered items to this many KiB
}
--- Clipboard
if vim.fn.has("wsl") == 1 then
vim.g.clipboard = {
name = "WslClipboard",
copy = {
["+"] = "clip.exe",
["*"] = "clip.exe",
},
paste = {
["+"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
["*"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
},
cache_enabled = 0,
}
end
o.clipboard = "unnamedplus" -- synchronize with system clipboard
-- Searching
o.ignorecase = true -- Ignore case when searching...
o.smartcase = true -- ...unless pattern contains uppercase characters.
o.wrapscan = false -- Don't wrap around the end of the file when searching.
-- Editing
o.expandtab = true -- use spaces when <Tab> is inserted
o.tabstop = 4 -- tabs are 4 spaces
o.shiftwidth = 0 -- (auto)indent using 'tabstop' spaces
o.smartindent = true -- use smart autoindenting
o.inccommand = "split" -- preview command partial results
o.joinspaces = false -- use one space after a period whe joining lines
o.showmatch = true -- briefly jump to matching bracket if insert one
o.virtualedit = "block" -- position the cursor anywhere in Visual Block mode
o.formatlistpat = [[^\s*\(\d\+[\]:.)}\t ]\|[-+*]\|[\[(][ x][\])]\)\s*]]
o.completeopt = {
"menu", -- show completions in a popup menu
"preview", -- show extra information about the selected match
"noinsert", -- don"t insert text until I select a match
"noselect", -- don"t pre-select the first match in the menu
}
local fmt = o.formatoptions
fmt:remove("t") -- Don't auto-wrap on 'textwidth'...
fmt:append("c") -- ...but do it within comment blocks...
fmt:append("l") -- ...but not if line was already long before entering Insert mode.
fmt:append("r") -- Insert comment leader when pressing Enter...
fmt:remove("o") -- ...but not when opening a new line with o & O.
fmt:append("q") -- allow formatting of comments with gq
fmt:remove("a") -- don"t auto-format every time text is inserted
fmt:append("n") -- indent lists automatically acc. 'formatlistpat'
fmt:append("j") -- remove comment leader when joining lines
fmt:append("1") -- don"t break lines after a one letter word but rather before it
-- Appearance
o.termguicolors = true -- use "gui" :higlight instead of "cterm"
o.showmode = false -- don't show mode (shown in statusline instead)
o.relativenumber = true -- Start off with relative line numbers...
o.number = true -- ...but real number for current line.
o.wrap = false -- don't wrap long lines initially
o.textwidth = 80 -- maximum width for text being inserted
o.colorcolumn = "" -- highlight column after 'textwidth'
o.cursorline = true -- highlight the line of the cursor
o.showbreak = "" -- prefix for wrapped lines
o.scrolloff = 3 -- min. # of lines above and below cursor
o.sidescrolloff = 3 -- min. # of columns to left and right of cursor
o.signcolumn = "yes" -- always display the signs column
o.list = false -- don't show invisible characters initially
o.listchars = {
eol = "",
tab = "󰌒 ", -- »
extends = "",
precedes = "",
trail = "·",
conceal = "",
}
o.fillchars = {
diff = "",
}
-- Wildcard Expansion
o.wildignore = {
".git",
".svn",
"__pycache__",
"**/tmp/**",
"*.DS_Store",
"*.dll",
"*.egg-info",
"*.exe",
"*.gif",
"*.jpeg",
"*.jpg",
"*.o",
"*.obj",
"*.out",
"*.png",
"*.pyc",
"*.so",
"*.zip",
"*~",
}
o.wildignorecase = true -- ignore case when completing file names
o.wildmode = "longest:full" -- longest common prefix first, then wildmenu
-- Window Splitting
o.splitbelow = true -- :split below current window
o.splitright = true -- :vsplit to the right of current window
o.equalalways = false -- don't resize all windows when splitting
-- Folding
o.foldenable = true -- enable folding
o.foldlevelstart = 100 -- start with all folds open
o.foldmethod = "syntax" -- fold based on syntax by default
o.foldnestmax = 10 -- limit nested folds to 10 levels
-- Options for diff mode
o.diffopt = { -- better side-by-side diffs
"filler", -- show filler lines (so text is vertically synced)
"vertical", -- use vertical splits (files side-by-side)
"closeoff", -- disable diff mode when one window is closed
}
end
-- stylua: ignore end
return M

View file

@ -1,58 +0,0 @@
return {
"FabijanZulj/blame.nvim",
cmd = "BlameToggle",
keys = {
{
"<leader>gb",
"<cmd>BlameToggle<cr>",
desc = require("util.icons").ui.Git .. " [g]it [b]lame (blame.nvim)",
},
},
opts = {
-- Using  (0xEACC) instead of - (0x2D) in `date_format` because `blame.nvim`
-- constructs each line and then uses `string.find({s}, {pattern})` to find
-- the position of the date in order to set the highlight. The normal dash
-- (0x2D) is a magic character in {pattern} and prevents the date from being
-- found and thus the highlight fails. Escaping the dash doesn't work because
-- the escape sequence would be visible in the final output, so my
-- workaround is to use a symbol that _looks like_ a dash, but isn't one.
date_format = "%Y%m%d",
commit_detail_view = "tab", -- Open commits in a new tab.
mappings = {
commit_info = { "i", "K" },
},
-- The default format uses _committer_ time, but I want _author_ time
-- (when I do rebases, I am interested in the original commit). A custom
-- formatting function also allows me to slightly tweak the final output.
format_fn = function(commit, config, idx)
local hash = string.sub(commit.hash, 1, 7)
if hash == "0000000" then
return {
idx = idx,
values = {
{ textValue = "·······", hl = "Comment" },
{ textValue = "Not commited", hl = "Comment" },
},
format = "%s %s",
}
end
return {
idx = idx,
values = {
{ textValue = hash, hl = hash },
{ textValue = os.date(config.date_format, commit.author_time), hl = hash },
{ textValue = commit.author, hl = hash },
},
format = "%s %s %s",
}
end,
},
}

View file

@ -1,14 +0,0 @@
return {
"norcalli/nvim-colorizer.lua",
cond = function(_) return vim.o.termguicolors end,
event = { "BufNewFile", "BufReadPost" },
opts = {
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
mode = "foreground",
},
config = function(_, opts) require("colorizer").setup(nil, opts) end,
}

View file

@ -1,49 +0,0 @@
local colorscheme = function(tbl)
return vim.tbl_deep_extend("keep", tbl, { lazy = false, priority = 1000 })
end
return {
colorscheme { "fschauen/gruvbox.nvim", dev = true },
colorscheme { "fschauen/solarized.nvim", dev = true },
colorscheme {
"catppuccin/nvim",
name = "catppuccin",
opts = {
flavor = "mocha",
show_end_of_buffer = true,
dim_inactive = { enabled = true },
integrations = { notify = true },
},
},
colorscheme {
"rebelot/kanagawa.nvim",
opts = {
dimInactive = true,
theme = "dragon",
overrides = function(colors)
local palette = colors.palette
return {
-- stylua: ignore start
Normal = { bg = palette.sumiInk2 },
CursorLine = { bg = palette.sumiInk3 },
LineNr = { bg = palette.sumiInk2 },
CursorLineNr = { bg = palette.sumiInk2 },
SignColumn = { bg = palette.sumiInk2 },
-- stylua: ignore end
}
end,
},
},
colorscheme {
"folke/tokyonight.nvim",
opts = {
style = "night",
dim_inactive = true,
on_colors = function(colors) colors.bg_highlight = "#1d212f" end,
},
},
}

View file

@ -1,16 +0,0 @@
return {
"tpope/vim-commentary",
cmd = "Commentary",
keys = function()
local icon = require("util.icons").ui.Comment
return {
-- stylua: ignore start
{ "gc", "<Plug>Commentary", mode = {"n", "x", "o"}, desc = icon.." Comment in/out" },
{ "gcc", "<Plug>CommentaryLine", desc = icon.." Comment in/out line" },
{ "gcu", "<Plug>Commentary<Plug>Commentary", desc = icon.." Undo comment in/out" },
-- stylua: ignore end
}
end,
}

View file

@ -1,129 +0,0 @@
local make_keymap = function(cmp)
local if_visible = function(yes, no)
no = no or function(fallback) fallback() end
return function(fallback)
if cmp.visible() then
yes(fallback)
else
no(fallback)
end
end
end
local m = cmp.mapping
local select = { behavior = cmp.SelectBehavior.Select }
local next_or_complete = if_visible(m.select_next_item(select), m.complete())
local prev_or_complete = if_visible(m.select_prev_item(select), m.complete())
local next = if_visible(m.select_next_item(select))
local prev = if_visible(m.select_prev_item(select))
local abort = if_visible(m.abort())
local confirm = if_visible(m.confirm { select = true })
local confirm_or_complete = if_visible(m.confirm { select = true }, m.complete())
local scroll_docs_down = m.scroll_docs(3)
local scroll_docs_up = m.scroll_docs(-3)
-- Mappings that should work in both command line and Insert mode.
return {
-- stylua: ignore start
["<c-n>"] = { i = next_or_complete, c = next_or_complete },
["<c-p>"] = { i = prev_or_complete, c = prev_or_complete },
["<c-j>"] = { i = next_or_complete, c = next },
["<c-k>"] = { i = prev_or_complete, c = prev },
["<down>"] = { i = next_or_complete, c = next },
["<up>"] = { i = prev_or_complete, c = prev },
["<s-down>"] = { i = scroll_docs_down, c = scroll_docs_down },
["<s-up>"] = { i = scroll_docs_up, c = scroll_docs_up },
["<c-c>"] = { i = abort, c = abort },
["<c-e>"] = { i = abort, c = abort },
["<c-y>"] = { i = confirm, c = confirm },
["<tab>"] = { i = confirm, c = confirm_or_complete },
-- stylua: ignore end
}
end
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"onsails/lspkind-nvim",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
event = { "CmdlineEnter", "InsertEnter" },
config = function()
local cmp = require("cmp")
local keymap = make_keymap(cmp)
cmp.setup {
mapping = keymap,
enabled = function()
local ctx = require("cmp.config.context")
return not ctx.in_treesitter_capture("comment")
and not ctx.in_syntax_group("Comment")
end,
snippet = {
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
formatting = {
format = require("lspkind").cmp_format {
mode = "symbol_text",
symbol_map = require("util.icons").kind,
menu = {
buffer = "buf",
nvim_lsp = "LSP",
nvim_lua = "lua",
path = "",
},
},
},
sources = cmp.config.sources({
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "path" },
{ name = "buffer", keyword_length = 5 },
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
experimental = { ghost_text = true },
}
cmp.setup.cmdline(":", {
mapping = keymap,
completion = { autocomplete = false },
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
cmp.setup.filetype("TelescopePrompt", {
enabled = false,
})
end,
}

View file

@ -1,71 +0,0 @@
return {
"monaqa/dial.nvim",
keys = function()
---Create a right hand side for `dial` key maps.
---@param cmd string: name of a function from `dial.map`.
---@param suffix? string: keys to add after `dial`s mapping.
---@return function
local dial_cmd = function(cmd, suffix)
suffix = suffix or ""
return function() return require("dial.map")[cmd]() .. suffix end
end
local icons = require("util.icons")
local inc, dec = icons.ui.Increment, icons.ui.Decrement
return {
-- stylua: ignore start
{ "<c-a>", dial_cmd("inc_normal"), expr = true, desc = inc.." Increment" },
{ "<c-x>", dial_cmd("dec_normal"), expr = true, desc = dec.." Decrement" },
{ "<c-a>", dial_cmd("inc_visual", "gv"), expr = true, desc = inc.." Increment", mode = "v" },
{ "<c-x>", dial_cmd("dec_visual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" },
{ "g<c-a>", dial_cmd("inc_gvisual", "gv"), expr = true, desc = inc.." Increment", mode = "v" },
{ "g<c-x>", dial_cmd("dec_gvisual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" },
-- stylua: ignore end
}
end,
config = function()
---Make a new augend that cycles over the given elements.
---@param elements string[]: the elements to cycle.
---@return table: @see `dial.types.Augend`
local cycle = function(elements)
return require("dial.augend").constant.new {
elements = elements,
word = true,
cyclic = true,
}
end
local weekdays = {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
}
local weekdays_short = vim.tbl_map(function(s) return s:sub(1, 3) end, weekdays)
local augend = require("dial.augend")
require("dial.config").augends:register_group {
default = {
augend.integer.alias.decimal_int,
augend.integer.alias.hex,
augend.integer.alias.binary,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%d/%m/%Y"],
augend.date.alias["%d.%m.%Y"],
cycle(weekdays),
cycle(weekdays_short),
},
}
end,
}

View file

@ -1,21 +0,0 @@
return {
"stevearc/dressing.nvim",
-- `vim.ui.select()` and `vim.ui.input()` can be used from the start.
lazy = false,
opts = {
input = {
insert_only = false, -- <esc> changes to Normal mode
mappings = {
n = {
["<C-c>"] = "Close",
},
i = {
["<c-k>"] = "HistoryPrev",
["<c-j>"] = "HistoryNext",
},
},
},
},
}

View file

@ -1,32 +0,0 @@
return {
"j-hui/fidget.nvim",
branch = "legacy",
event = "LspAttach",
opts = {
text = {
done = require("util.icons").ui.Checkmark,
spinner = {
"▱▱▱▱▱▱▱",
"▰▱▱▱▱▱▱",
"▰▰▱▱▱▱▱",
"▰▰▰▱▱▱▱",
"▰▰▰▰▱▱▱",
"▰▰▰▰▰▱▱",
"▰▰▰▰▰▰▱",
"▰▰▰▰▰▰▰",
"▱▰▰▰▰▰▰",
"▱▱▰▰▰▰▰",
"▱▱▱▰▰▰▰",
"▱▱▱▱▰▰▰",
"▱▱▱▱▱▰▰",
"▱▱▱▱▱▱▰",
},
},
timer = { spinner_rate = 75 },
window = { blend = 50 },
fmt = { max_messages = 10 },
},
}

View file

@ -1,75 +0,0 @@
local shfmt = function()
local indent = 0 -- Assume tabs initially.
if vim.o.expandtab then
local shiftwidth = vim.opt.shiftwidth:get()
if shiftwidth == 0 then
indent = vim.o.tabstop
else
indent = shiftwidth
end
end
return {
exe = "shfmt",
-- stylua: ignore start
args = {
"--indent", indent, -- 0 for tabs, >0 for number of spaces.
"--keep-padding", -- Keep column alignment paddings.
},
-- stylua: ignore end
stdin = true,
}
end
return {
"mhartington/formatter.nvim",
cmd = {
"Format",
"FormatLock",
"FormatWrite",
"FormatWriteLock",
},
keys = function()
local icon = require("util.icons").ui.Format
return {
{
"<leader>F",
require("util.autoformat").toggle,
desc = icon .. " Toggle auto [F]ormat on write",
},
{
"<leader>=",
"<cmd>Format<cr>",
desc = icon .. " format file",
},
{
"<c-f>",
"<cmd>Format<cr>",
mode = "i",
desc = icon .. " [f]ormat file",
},
}
end,
opts = function()
local builtin = require("formatter.filetypes")
return {
filetype = {
-- stylua: ignore start
c = { builtin.c.clangformat },
cmake = { builtin.cmake.cmakeformat },
cpp = { builtin.cpp.clangformat },
cs = { builtin.cs.clangformat },
json = { builtin.cs.prettier },
lua = { builtin.lua.stylua },
markdown = { builtin.markdown.prettier },
python = {}, -- TODO: pick one
sh = { shfmt() },
zsh = { builtin.zsh.beautysh },
-- stylua: ignore end
},
}
end,
}

View file

@ -1,15 +0,0 @@
return {
"tpope/vim-fugitive",
cmd = { "G", "Git" },
keys = function()
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gS", "<cmd>tab Git<cr>", desc = icon.." [g]it [S]status (fugitive)" },
{ "<leader>gB", "<cmd>Git blame<cr>", desc = icon.." [g]it [B]lame (fugitive)" },
-- stylua: ignore end
}
end,
}

View file

@ -1,33 +0,0 @@
return {
"rhysd/git-messenger.vim",
cmd = "GitMessenger",
keys = function()
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gm", "<cmd>GitMessenger<cr>", desc = icon.." [g]it [m]essenger" },
-- stylua: ignore end
}
end,
init = function()
-- Disable default mappings, as I have my own for lazy-loading.
vim.g.git_messenger_no_default_mappings = true
-- Always move cursor into pop-up window immediately.
vim.g.git_messenger_always_into_popup = true
-- Add a border to the floating window, otherwise it's confusing.
vim.g.git_messenger_floating_win_opts = {
border = "rounded",
}
-- Make the UI a bit more compact by removing margins.
vim.g.git_messenger_popup_content_margins = false
-- Extra arguments passed to `git blame`:
-- vim.g.git_messenger_extra_blame_args = '-w'
end,
}

View file

@ -1,51 +0,0 @@
return {
"ruifm/gitlinker.nvim",
dependencies = "nvim-lua/plenary.nvim",
keys = function()
local open_repo = function()
require("gitlinker").get_repo_url {
action_callback = require("gitlinker.actions").open_in_browser,
}
end
local browser = function(mode)
return function()
require("gitlinker").get_buf_range_url(mode, {
action_callback = require("gitlinker.actions").open_in_browser,
})
end
end
local clipboard = function(mode)
return function()
require("gitlinker").get_buf_range_url(mode, {
action_callback = require("gitlinker.actions").copy_to_clipboard,
})
end
end
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gr", open_repo, desc = icon.." open [r]epository in browser" },
{ "<leader>gl", clipboard("n"), desc = icon.." copy perma[l]ink to clipboard" },
{ "<leader>gl", clipboard("v"), desc = icon.." copy perma[l]ink to clipboard", mode = "v" },
{ "<leader>gL", browser("n"), desc = icon.." open perma[L]ink in browser" },
{ "<leader>gL", browser("v"), desc = icon.." open perma[L]ink in browser", mode = "v" },
-- stylua: ignore end
}
end,
-- This really does need to be a function, because we need to defer requiring
-- the `gitlinker.hosts` module until after the plugin is loaded.
opts = function()
return {
mappings = nil, -- I'm defining my own mappings above.
callbacks = {
["git.schauenburg.me"] = require("gitlinker.hosts").get_gitea_type_url,
},
}
end,
}

View file

@ -1,34 +0,0 @@
return {
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
ft = "markdown",
opts = function()
-- These work well with gruvbox.
vim.cmd([[highlight Headline1 guibg=#161613]])
vim.cmd([[highlight Headline2 guibg=#191915]])
vim.cmd([[highlight Headline3 guibg=#1c1c17]])
vim.cmd([[highlight Headline4 guibg=#1a1b19]])
vim.cmd([[highlight Headline5 guibg=#171a1b]])
vim.cmd([[highlight CodeBlock guibg=#121717]])
vim.cmd([[highlight Quote guifg=#076678]])
vim.cmd([[highlight Dash guifg=#d5c4a1]])
return {
markdown = {
headline_highlights = {
"Headline1",
"Headline2",
"Headline3",
"Headline4",
"Headline5",
},
bullets = "",
dash_string = "",
fat_headlines = false,
},
}
end,
}

View file

@ -1,34 +0,0 @@
local ui = require("util.icons").ui
return {
"lukas-reineke/indent-blankline.nvim",
cmd = {
"IBLEnable",
"IBLDisable",
"IBLToggle",
"IBLEnableScope",
"IBLDisableScope",
"IBLToggleScope",
},
keys = {
-- stylua: ignore start
{ "<leader>si", "<cmd>IBLToggle<cr>", desc = ui.Toggle.." toggle [i]ndent lines" },
{ "<leader>so", "<cmd>IBLToggleScope<cr>", desc = ui.Toggle.." toggle indent line sc[o]pe" },
-- stylua: ignore end
},
main = "ibl",
opts = {
enabled = false,
indent = { char = ui.LineLeft },
scope = {
char = ui.LineLeftBold,
enabled = false,
show_start = false,
show_end = false,
},
},
}

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 +0,0 @@
return { "milisims/nvim-luaref" }

View file

@ -1,40 +0,0 @@
return {
"iamcco/markdown-preview.nvim",
build = function() vim.fn["mkdp#util#install"]() end,
cmd = {
"MarkdownPreview",
"MarkdownPreviewStop",
"MarkdownPreviewToggle",
},
ft = "markdown",
init = function()
vim.g.mkdp_theme = "dark"
-- Don't close the preview when switching to another buffer.
vim.g.mkdp_auto_close = 0
-- Show preview page URL in command line when opening preview page.
vim.g.mkdp_echo_preview_url = 1
end,
config = function()
local icon = require("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 }),
pattern = "markdown",
callback = function()
vim.keymap.set(
"n",
"<leader>P",
"<cmd>MarkdownPreviewToggle<cr>",
{ buffer = true, desc = icon .. " toggle [P]review" }
)
end,
})
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,38 +0,0 @@
return {
"danymat/neogen",
keys = function()
local icon = require("util.icons").ui.Annotation
return {
{
"<leader>aa",
function() require("neogen").generate() end,
desc = icon .. " generate [a]nnotation [a]utomatically",
},
{
"<leader>ac",
function() require("neogen").generate { type = "class" } end,
desc = icon .. " generate [a]nnotation for [c]lass",
},
{
"<leader>af",
function() require("neogen").generate { type = "func" } end,
desc = icon .. " generate [a]nnotation for [f]unction",
},
{
"<c-l>",
function() require("neogen").jump_next() end,
mode = "i",
desc = icon .. " next annotation placeholder",
},
{
"<c-h>",
function() require("neogen").jump_prev() end,
mode = "i",
desc = icon .. " previous annotation placeholder",
},
}
end,
config = true,
}

View file

@ -1,47 +0,0 @@
local ui = require("util.icons").ui
return {
"NeogitOrg/neogit",
cmd = "Neogit",
dependencies = "nvim-lua/plenary.nvim",
keys = {
{ "<leader>gs", "<cmd>Neogit<cr>", desc = ui.Git .. " [g]it [s]tatus (Neogit)" },
},
opts = {
commit_editor = {
kind = "tab",
show_staged_diff = false,
},
disable_insert_on_commit = true,
disable_hint = true,
graph_style = "unicode",
signs = {
section = {
ui.Folder,
ui.EmptyFolderOpen,
},
item = {
ui.ChevronRight,
ui.ChevronDown,
},
hunk = {
ui.ChevronSmallRight,
ui.ChevronSmallDown,
},
},
mappings = {
status = {
o = "GoToFile",
["="] = "Toggle",
},
},
},
}

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,20 +0,0 @@
return {
"mfussenegger/nvim-lint",
keys = function()
return {
{
"<leader>L",
function() require("lint").try_lint() end,
desc = require("util.icons").ui.Lint .. " [L]int file",
},
}
end,
config = function()
require("lint").linters_by_ft = {
markdown = { "markdownlint" },
sh = { "shellcheck" },
}
end,
}

View file

@ -1,58 +0,0 @@
return {
"rcarriga/nvim-notify",
keys = function()
local telescope_notifications = function()
local telescope = vim.F.npcall(require, "telescope")
if not telescope then
vim.notify("Telescope is not installed!", vim.log.levels.WARN)
return
end
local theme = require("telescope.themes").get_dropdown {
results_title = " Results ",
prompt_title = "  Notifications ",
}
telescope.load_extension("notify").notify(theme)
end
local dismiss_notifications = function() require("notify").dismiss() end
local keymap = require("config.plugins.telescope").keymap
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" },
-- stylua: ignore end
}
end,
lazy = false,
config = function()
local notify = require("notify")
local icons = require("util.icons")
notify.setup {
icons = {
ERROR = icons.diagnostics_bold.Error,
WARN = icons.diagnostics_bold.Warn,
INFO = icons.diagnostics.Info,
DEBUG = icons.diagnostics.Debug,
TRACE = icons.diagnostics.Trace,
},
fps = 24,
max_width = 50,
minimum_width = 50,
render = "wrapped-compact",
stages = "fade",
time_formats = {
notification_history = "%F %T │ ",
},
}
vim.notify = notify
end,
}

View file

@ -1,92 +0,0 @@
local on_attach = function(buffer)
local api = require("nvim-tree.api")
-- Give me the default mappings except <c-x>, which I replace with <c-s>.
api.config.mappings.default_on_attach(buffer)
vim.keymap.del("n", "<c-x>", { buffer = buffer })
local map = vim.keymap.set
local opts = function(desc)
return {
desc = "󰙅 nvim-tree: " .. desc,
buffer = buffer,
silent = true,
}
end
-- stylua: ignore start
map("n", "l", api.node.open.edit, opts("Open"))
map("n", "<cr>", api.node.open.edit, opts("Open"))
map("n", "<c-s>", api.node.open.horizontal, opts("Open: Horizontal Split"))
map("n", "h", api.node.navigate.parent_close, opts("Close directory"))
-- stylua: ignore end
end
local icons = require("util.icons")
return {
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
keys = {
-- stylua: ignore start
{ "<leader>tt", "<cmd>NvimTreeToggle<cr>", desc = icons.ui.FileTree.." [t]oggle [t]ree" },
{ "<leader>tf", "<cmd>NvimTreeFindFile<cr>", desc = icons.ui.FileTree.." Open [t]ree to current [f]ile " },
-- stylua: ignore end
},
opts = {
disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
on_attach = on_attach,
git = {
ignore = false, -- don't hide files from .gitignore
show_on_open_dirs = false, -- don't show indication if dir is open
},
view = {
adaptive_size = true, -- resize the window based on the longest line
cursorline = false, -- don't enable 'cursorline' in the tree
width = 35, -- a little wider than the default 30
},
filters = {
dotfiles = false, -- show files starting with a .
custom = { "^\\.git" }, -- don't show .git directory
},
renderer = {
add_trailing = true, -- add trailing / to folders
highlight_git = true, -- enable highlight based on git attributes
icons = {
webdev_colors = false, -- highlight icons with NvimTreeFileIcon
git_placement = "signcolumn",
-- stylua: ignore start
glyphs = {
default = icons.ui.File,
symlink = icons.ui.FileSymlink,
modified = icons.ui.Circle,
folder = {
arrow_closed = icons.ui.ChevronSmallRight,
arrow_open = icons.ui.ChevronSmallDown,
default = icons.ui.Folder,
open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.FolderSymlink,
symlink_open = icons.ui.FolderSymlink,
},
git = {
untracked = icons.git.file.Untracked,
unstaged = icons.git.file.Unstaged,
staged = icons.git.file.Staged,
deleted = icons.git.file.Deleted,
unmerged = icons.git.file.Unmerged,
renamed = icons.git.file.Renamed,
ignored = icons.git.file.Ignored,
},
},
-- stylua: ignore end
},
},
},
}

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,23 +0,0 @@
return {
"tyru/open-browser.vim",
cmd = {
"OpenBrowser",
"OpenBrowserSearch",
"OpenBrowserSmartSearch",
},
keys = function()
local icon = require("util.icons").ui.Web
return {
{
"<leader>o",
"<Plug>(openbrowser-smart-search)",
desc = icon .. " [o]pen URL under cursor or search the web",
mode = { "n", "v" },
},
}
end,
init = function() vim.g.openbrowser_default_search = "duckduckgo" end,
}

View file

@ -1,42 +0,0 @@
return {
"weirongxu/plantuml-previewer.vim",
dependencies = "tyru/open-browser.vim",
cmd = {
"PlantumlOpen",
"PlantumlStart",
"PlantumlStop",
"PlantumlSave",
},
ft = "plantuml",
init = function()
-- Prefer the system PlantUML (if any) over the one bundled with the plugin.
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
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 })
vim.api.nvim_create_autocmd("FileType", {
desc = "Create key map to toggle plantuml preview.",
group = group,
pattern = "plantuml",
callback = function()
vim.keymap.set(
"n",
"<leader>P",
"<cmd>PlantumlToggle<cr>",
{ buffer = true, desc = icon .. " toggle PlantUML [P]review" }
)
end,
})
end,
}

View file

@ -1,6 +0,0 @@
return {
{ "mityu/vim-applescript", ft = "applescript" },
{ "chr4/nginx.vim", ft = "nginx" },
{ "keith/swift.vim", ft = "swift" },
{ "aklt/plantuml-syntax", ft = "plantuml" },
}

View file

@ -1,17 +0,0 @@
return {
"godlygeek/tabular",
cmd = {
"AddTabularPattern",
"AddTabularPipeline",
"Tabularize",
},
config = function()
if vim.fn.exists("g:tabular_loaded") == 1 then
vim.cmd([[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]])
vim.cmd([[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]])
vim.cmd([[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]])
end
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,
}

Some files were not shown because too many files have changed in this diff Show more