Add perl support in nvim. Fic irssi config.

This commit is contained in:
Jan Eitzinger 2024-05-07 07:18:37 +02:00
parent 593dcbda8e
commit adfbdb470e
12 changed files with 6222 additions and 235 deletions

View File

@ -56,7 +56,7 @@ o.splitright = true
o.virtualedit = 'block' o.virtualedit = 'block'
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
o.laststatus = 3 -- always show status line o.laststatus = 3 -- always show status line
o.list = true -- do not display white characters o.list = false -- do not display white characters
o.termguicolors = true o.termguicolors = true
o.wrap = false --do not wrap lines even if very long o.wrap = false --do not wrap lines even if very long
o.eol = false -- show if there's no eol char o.eol = false -- show if there's no eol char
@ -207,6 +207,7 @@ map('v', 'Q', '<cmd>norm @q<CR>')
-- save file -- save file
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" }) map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
map({ "i", "n" }, "<C-s><C-s>", "<cmd>silent! xa<cr><cmd>qa<cr>", { desc = "Save all and quit" })
-- better indenting -- better indenting
map("v", "<", "<gv") map("v", "<", "<gv")

View File

@ -3,13 +3,12 @@ return {
-- snippets -- snippets
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
build = (not jit.os:find("Windows")) build = "gmake install_jsregexp",
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
or nil,
dependencies = { dependencies = {
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
config = function() config = function()
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
end, end,
}, },
opts = { opts = {

View File

@ -0,0 +1,367 @@
# #!/usr/bin/perl
snippet #!
#!/usr/bin/env perl
# Hash Pointer
snippet .
=>
# Function
snippet sub
sub ${1:function_name} {
${0}
}
# Conditional
snippet if
if (${1}) {
${0}
}
# Conditional if..else
snippet ife
if (${1}) {
${2}
}
else {
${0}
}
# Conditional if..elsif..else
snippet ifee
if (${1}) {
${2}
}
elsif (${3}) {
${4:# elsif...}
}
else {
${0}
}
snippet eif
elsif (${1}) {
${0}
}
# Conditional One-line
snippet xif
$1 if $0;
# Unless conditional
snippet unless
unless (${1}) {
${0}
}
# Unless conditional One-line
snippet xunless
$1 unless $0;
# Try/Except
snippet eval
local $@;
eval {
${1:# do something risky...}
};
if (my $e = $@) {
${0:# handle failure...}
}
# While Loop
snippet wh
while (${1}) {
${0}
}
# While Loop One-line
snippet xwh
$1 while $0;
# C-style For Loop
snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${0}
}
# For loop one-line
snippet xfor
$1 for @$0;
# Foreach Loop
snippet for
foreach my $${1:x} (@${2:array}) {
${0}
}
# Foreach Loop One-line
snippet fore
$1 foreach @$0;
# Package
snippet package
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`};
use strict;
use warnings;
${0}
1;
__END__
# Package syntax perl >= 5.14
snippet packagev514
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`} ${2:0.99};
use v5.14;
use warnings;
${0}
1;
__END__
#moose
snippet moose
use Moose;
use namespace::autoclean;
${1:#}BEGIN {extends '${2:ParentClass}'};
${0}
# parent
snippet parent
use parent qw(${0:Parent Class});
# Read File
snippet slurp
my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
${0}
# strict warnings
snippet strwar
use strict;
use warnings;
# older versioning with perlcritic bypass
snippet vers
## no critic
our $VERSION = '${0:version}';
eval $VERSION;
## use critic
# new 'switch' like feature
snippet switch
use feature 'switch';
# Anonymous subroutine
snippet asub
sub {
${0}
}
# Begin block
snippet begin
BEGIN {
${0}
}
# call package function with some parameter
snippet pkgmv
__PACKAGE__->${1:package_method}(${0:var})
# call package function without a parameter
snippet pkgm
__PACKAGE__->${0:package_method}()
# call package "get_" function without a parameter
snippet pkget
__PACKAGE__->get_${0:package_method}()
# call package function with a parameter
snippet pkgetv
__PACKAGE__->get_${1:package_method}(${0:var})
# complex regex
snippet qrx
qr/
${0:regex}
/xms
#simpler regex
snippet qr/
qr/${0:regex}/x
#given
snippet given
given ($${1:var}) {
${2:# cases}
${0:# default}
}
# switch-like case
snippet when
when (${1:case}) {
${0}
}
# hash slice
snippet hslice
@{ ${1:hash} }{ ${0:array} }
# map
snippet map
map { ${0: body } } ${1: @array } ;
# Pod stub
snippet ppod
=head1 NAME
${1:ClassName} - ${2:ShortDesc}
=head1 SYNOPSIS
use $1;
${3:# synopsis...}
=head1 DESCRIPTION
${0:# longer description...}
=head1 INTERFACE
=head1 DEPENDENCIES
=head1 SEE ALSO
# Heading for a subroutine stub
snippet psub
=head2 ${1:MethodName}
${0:Summary....}
# Heading for inline subroutine pod
snippet psubi
=head2 ${1:MethodName}
${0:Summary...}
=cut
# inline documented subroutine
snippet subpod
=head2 $1
Summary of $1
=cut
sub ${1:subroutine_name} {
${0}
}
# Subroutine signature
snippet parg
=over 2
=item
Arguments
=over 3
=item
C<${1:DataStructure}>
${2:Sample}
=back
=item
Return
=over 3
=item
C<${0:...return data}>
=back
=back
# Moose has
snippet has
has ${1:attribute} => (
is => '${2:ro|rw}',
isa => '${3:Str|Int|HashRef|ArrayRef|etc}',
default => sub {
${4:defaultvalue}
},
${0:# other attributes}
);
# override
snippet override
override ${1:attribute} => sub {
${2:# my $self = shift;};
${0:# my ($self, $args) = @_;};
};
# use test classes
snippet tuse
use Test::More;
use Test::Deep; # (); # uncomment to stop prototype errors
use Test::Exception;
# local test lib
snippet tlib
use lib qw{ ./t/lib };
#test methods
snippet tmeths
$ENV{TEST_METHOD} = '${0:regex}';
# runtestclass
snippet trunner
use ${0:test_class};
$1->runtests();
# Test::Class-style test
snippet tsub
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
my $self = shift;
${0}
}
# Test::Routine-style test
snippet trsub
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
my ($self) = @_;
${0}
};
#prep test method
snippet tprep
sub prep${1:number}_${2:test_case} :Test(startup) {
my $self = shift;
${0}
}
# cause failures to print stack trace
snippet debug_trace
use Carp; # 'verbose';
# cloak "die"
# warn "warning"
$SIG{'__DIE__'} = sub {
require Carp; Carp::confess
};
snippet dump
use Data::Dump qw(dump);
warn dump ${1:variable}
snippet ddp
use DDP;
p ${1:variable}
snippet subtest
subtest '${1: test_name}' => sub {
${2}
};

273
dot_irssi/bork.theme Normal file
View File

@ -0,0 +1,273 @@
#
# ---------------------------------
# Author: fraki a.k.a. Joolzman a.k.a. blender
# Mail: julian@sourcecod.com
# Website: http://julian.sourcecod.com/
# ---------------------------------
#
# these characters are automatically replaced with specified color
# (dark grey by default)
replaces = { "=" = "%w$0-%n"; };
abstracts = {
##
## generic
##
# text to insert at the beginning of each non-message line
line_start = "%c-%n ";
# timestamp styling, nothing by default
timestamp = "%n$0-";
# any kind of text that needs hilighting, default is to bold
hilight = "%_$0-%_";
# any kind of error message, default is bright red
error = "%r$0-%n";
# channel name is printed
channel = "%c$0-%n";
# nick is printed
nick = "%c$0-";
# nick host is printed
nickhost = "%w$0-";
# server name is printed
server = "$0-";
# some kind of comment is printed
comment = "%n$0-";
# reason for something is printed (part, quit, kick, ..)
reason = "%c[%n{comment $0-}%c]%n";
# mode change is printed ([+o nick])
mode = "%Y$0-%n";
##
## channel specific messages
##
# highlighted nick/host is printed (joins)
channick_hilight = "%C$0-%n";
chanhost_hilight = "{nickhost %n$0-}";
# nick/host is printed (parts, quits, etc.)
channick = "%c$0-%n";
chanhost = "{nickhost %w$0-%n}";
# highlighted channel name is printed
channelhilight = "%c$0-%n";
# ban/ban exception/invite list mask is printed
ban = "%c$0-%n";
##
## messages
##
# the basic styling of how to print message, $0 = nick mode, $1 = nick
msgnick = "%n$0%n$1- %|";
# message from you is printed. "msgownnick" specifies the styling of the
# nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the
# whole line.
# Example1: You want the message text to be green:
# ownmsgnick = "{msgnick $0 $1-}%g";
# Example2.1: You want < and > chars to be yellow:
# ownmsgnick = "%Y{msgnick $0 $1-%Y}%n";
# (you'll also have to remove <> from replaces list above)
# Example2.2: But you still want to keep <> grey for other messages:
# pubmsgnick = "%K{msgnick $0 $1-%K}%n";
# pubmsgmenick = "%K{msgnick $0 $1-%K}%n";
# pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n";
# ownprivmsgnick = "%K{msgnick $0-%K}%n";
# privmsgnick = "%K{msgnick %R$0-%K}%n";
# $0 = nick mode, $1 = nick
ownmsgnick = "{msgnick $0 $1}%n";
ownnick = "%g<%W$0%g>%n";
# public message in channel, $0 = nick mode, $1 = nick
pubmsgnick = "{msgnick $0 $1}%n";
pubnick = "%y<%n$0%y>%n";
# public message in channel meant for me, $0 = nick mode, $1 = nick
pubmsgmenick = "{msgnick %_$0%_ $1}%n";
menick = "%y<%W$0%y>%n ";
# public highlighted message in channel
# $0 = highlight color, $1 = nick mode, $2 = nick
pubmsghinick = "%W$1%y<%W$2%y>%n ";
# channel name is printed with message
msgchannel = "%w:%c$0-%n";
# private message, $0 = nick, $1 = host
privmsg = "%r- *%n$0%r* %n%|";
# private message from you, $0 = "msg", $1 = target nick
ownprivmsg = "%r- --> %n$1%r:%n %|";
# own private message in query
ownprivmsgnick = " %r<%n{msgnick $0-%r>%n}%|";
ownprivnick = " %n$0";
# private message in query
privmsgnick = " {msgnick %r*%n$0%r* %n}%|";
##
## Actions (/ME stuff)
##
# used internally by this theme
action_core = "$0-%n";
# generic one that's used by most actions
action = "{action_core $0-} ";
# own action, both private/public
ownaction = " %g* {action %W$0-}%n";
# own action with target, both private/public
ownaction_target = " %y* {hilight $0}%n:%c$1%n ";
# private action sent by others
pvtaction = "%r- *%n $0-%n ";
pvtaction_query = "%r- * %n{action $0-}";
# public action sent by others
pubaction = " %y* %n{action $0-}";
##
## other IRC events
##
# notices
ownnotice = "%c- %n$0 to %c$1%n: %|";
notice = "%c-%n notice from %c$0-%n: %|";
pubnotice_channel = "%c:%C$0-%|";
pvtnotice_host = "%n ($0-)%|";
servernotice = "%r- %c$0-%n %|";
# CTCPs
ownctcp = "%c- %n$0 to %c$1%n: ";
ctcp = "%c- %n$0-%n";
# wallops
wallop = "%W$0-%n: ";
wallop_nick = "%n$0-";
wallop_action = "%W * $0-%n ";
# netsplits
netsplit = "%r$0-%n";
netjoin = "%r$0-%n";
# /names list
names_nick = "[%c$0%n$1-%n] ";
names_users = "%w$0-%n:";
names_channel = "%c$0-%n";
# DCC
dcc = "%c- $0-%n";
dccfile = "$0-";
# DCC chat, own msg/action
dccownmsg = "[%r$0%K($1-%K)%n] ";
dccownnick = "%R$0-%n";
dccownaction = "{action $0-}";
dccownaction_target = "{action_core $0}%K:%c$1%n ";
# DCC chat, others
dccmsg = "[%G$1-%K(%g$0%K)%n] ";
dccquerynick = "%G$0-%n";
dccaction = "%W (*dcc*) $0-%n %|";
##
## statusbar
##
# background of statusbar
sb_background = "%4";
# default statusbar item style
sb = "%n$0- | ";
# background for topicbar (same default)
# sb_topic_bg = "%0";
# text at the beginning of statusbars. sb-item already puts
# space there,so we don't use anything by default.
sbstart = "";
# text at the end of statusbars. Use space so that it's never
# used for anything.
sbend = " ";
sbmode = " %n(+$0-)";
sbaway = " (%nAway%n)";
sbservertag = ": $0";
sbmore = "%_-- more --%_";
sblag = "{sb L: %R$0-}";
sbmail = "{sb M: $0-}";
# activity. Det is used for hilights when display doesn't support colors
sb_act_sep = "%n$*";
sb_act_text = "%n$*";
sb_act_msg = "%w$*";
sb_act_hilight = "%n$*%n";
sb_act_hilight_color = "%_%c$1-%_%n";
};
formats = {
"fe-common/core" = {
join = "{channick_hilight $0}!$1 %yjoined%n %c$2%n";
part = "{channick_hilight $0}!$1 %yleft%n %c$2%n {reason $3}";
kick = "{channick_hilight $0} was %ykicked%n from {channel $1} by {nick $2} {reason $3}";
quit = "%yQuit%n: {channick_hilight $0}!{chanhost $1} {reason $2}";
endofnames = "%C$0%N: %Y$1 %Wnicks%n ({comment ops: %W$2%n, voices: %W$4%n, regular: %W$5%n})";
own_msg = "{ownmsgnick {ownnick $[-15]0$2}}$1";
own_msg_channel = "{ownmsgnick {ownnick $[-15]0$3}{msgchannel $1}}$2";
own_msg_private_query = "{ownprivmsgnick {ownprivnick $[-15]2}}$1";
pubmsg_me = "{pubmsgmenick {menick $[-15]0}$2}$1";
pubmsg_me_channel = "{pubmsgmenick {menick $[-15]0$3}{msgchannel $1}}$2";
pubmsg_hilight = "{pubmsghinick $0 $0 $[-15]1$3%n}$2";
pubmsg_hilight_channel = "{pubmsghinick $0 $[-15]1$4{msgchannel $2}}$3";
pubmsg = "{pubmsgnick {pubnick %w$[-15]0}$2}$1";
pubmsg_channel = "{pubmsgnick {pubnick %w$[-15]0}$2}$1";
msg_private_query = "{privmsgnick $[-15]0}$2";
};
"fe-common/irc" = {
chanmode_change = "Mode change {mode $1} on {channelhilight $0} by {nick $2}";
server_chanmode_change = "ServerMode: {mode $1} on {channelhilight $0} by {nick $2}";
netsplit_more = "{netsplit Netsplit} ({server $0} <--/ /--> {server $1}) Disconnects: {nick $2} (and another $3, /NETSPLIT for a full list.)";
netsplit = "{netsplit Netsplit} ({server $0} <--/ /--> {server $1}) Disconnects: {nick $2}";
netsplit_join = "{netjoin Netsplit} over, joins: {nick $0}";
netsplit_join_more = "{netjoin Netsplit} over, joins: {nick $0} (and $1 more)";
notice_private = "{notice $0}$2";
ctcp_reply = "%c-%n CTCP {hilight $0} reply from {nick $1}: $2";
ctcp_ping_reply = "%c-%n CTCP {hilight PING} reply from {nick $0}: %Y$1.$[-3.0]2%n seconds";
ctcp_requested = "{ctcp {nick $0}%n!{comment $1} requested CTCP {hilight $2} from {nick $4}} $3";
ctcp_requested_unknown = "{ctcp {nick $0}%n!{comment $1} requested unknown CTCP {hilight $2} from {nick $4}} $3";
ctcp_reply_channel = "%c-%n CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2";
channel_mode = "Mode on {channelhilight $0} is {mode $1}";
own_action = "{ownaction $[-13]0} $1";
action_private = "{pvtaction $[-13]0}$1";
action_private_query = "{pvtaction_query $[-13]0} $2";
action_public = "{pubaction $[-13]0}$1";
};
"fe-text" = {
lastlog_start = "%_------- %c-%n %_{hilight Lastlog}%_:";
lastlog_end = "%_------- %c-%n%_ {hilight End of lastlog}%_";
};
"fe-common/irc/dcc" = {
dcc_ctcp = "{dcc %c-%n DCC CTCP {hilight $1} received from {hilight $0}: $2}";
own_dcc_query = " %r<%n{ownmsgnick {dccownquerynick $0}%r>%n}$2";
dcc_msg_query = "{privmsgnick $0}$1";
own_dcc_action = " %r*%n {dccownaction_target $0 $1}$2";
own_dcc_action_query = " %r*%n {dccownaction $0}$2";
};
};

294
dot_irssi/default.theme Normal file
View File

@ -0,0 +1,294 @@
# When testing changes, the easiest way to reload the theme is with /RELOAD.
# This reloads the configuration file too, so if you did any changes remember
# to /SAVE it first. Remember also that /SAVE overwrites the theme file with
# old data so keep backups :)
# TEMPLATES:
# The real text formats that irssi uses are the ones you can find with
# /FORMAT command. Back in the old days all the colors and texts were mixed
# up in those formats, and it was really hard to change the colors since you
# might have had to change them in tens of different places. So, then came
# this templating system.
# Now the /FORMATs don't have any colors in them, and they also have very
# little other styling. Most of the stuff you need to change is in this
# theme file. If you can't change something here, you can always go back
# to change the /FORMATs directly, they're also saved in these .theme files.
# So .. the templates. They're those {blahblah} parts you see all over the
# /FORMATs and here. Their usage is simply {name parameter1 parameter2}.
# When irssi sees this kind of text, it goes to find "name" from abstracts
# block below and sets "parameter1" into $0 and "parameter2" into $1 (you
# can have more parameters of course). Templates can have subtemplates.
# Here's a small example:
# /FORMAT format hello {colorify {underline world}}
# abstracts = { colorify = "%G$0-%n"; underline = "%U$0-%U"; }
# When irssi expands the templates in "format", the final string would be:
# hello %G%Uworld%U%n
# ie. underlined bright green "world" text.
# and why "$0-", why not "$0"? $0 would only mean the first parameter,
# $0- means all the parameters. With {underline hello world} you'd really
# want to underline both of the words, not just the hello (and world would
# actually be removed entirely).
# COLORS:
# You can find definitions for the color format codes in docs/formats.txt.
# There's one difference here though. %n format. Normally it means the
# default color of the terminal (white mostly), but here it means the
# "reset color back to the one it was in higher template". For example
# if there was /FORMAT test %g{foo}bar, and foo = "%Y$0%n", irssi would
# print yellow "foo" (as set with %Y) but "bar" would be green, which was
# set at the beginning before the {foo} template. If there wasn't the %g
# at start, the normal behaviour of %n would occur. If you _really_ want
# to use the terminal's default color, use %N.
#############################################################################
# default foreground color (%N) - -1 is the "default terminal color"
default_color = "-1";
# print timestamp/servertag at the end of line, not at beginning
info_eol = "false";
# these characters are automatically replaced with specified color
# (dark grey by default)
replaces = { "[]=" = "%K$*%n"; };
abstracts = {
##
## generic
##
# text to insert at the beginning of each non-message line
line_start = "%B-%n!%B-%n ";
# timestamp styling, nothing by default
timestamp = "$*";
# any kind of text that needs hilighting, default is to bold
hilight = "%_$*%_";
# any kind of error message, default is bright red
error = "%R$*%n";
# channel name is printed
channel = "%_$*%_";
# nick is printed
nick = "%_$*%_";
# nick host is printed
nickhost = "[$*]";
# server name is printed
server = "%_$*%_";
# some kind of comment is printed
comment = "[$*]";
# reason for something is printed (part, quit, kick, ..)
reason = "{comment $*}";
# mode change is printed ([+o nick])
mode = "{comment $*}";
##
## channel specific messages
##
# highlighted nick/host is printed (joins)
channick_hilight = "%C$*%n";
chanhost_hilight = "{nickhost %c$*%n}";
# nick/host is printed (parts, quits, etc.)
channick = "%c$*%n";
chanhost = "{nickhost $*}";
# highlighted channel name is printed
channelhilight = "%c$*%n";
# ban/ban exception/invite list mask is printed
ban = "%c$*%n";
##
## messages
##
# the basic styling of how to print message, $0 = nick mode, $1 = nick
msgnick = "%K<%n$0$1-%K>%n %|";
# message from you is printed. "ownnick" specifies the styling of the
# nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the
# whole line.
# Example1: You want the message text to be green:
# ownmsgnick = "{msgnick $0 $1-}%g";
# Example2.1: You want < and > chars to be yellow:
# ownmsgnick = "%Y{msgnick $0 $1-%Y}%n";
# (you'll also have to remove <> from replaces list above)
# Example2.2: But you still want to keep <> grey for other messages:
# pubmsgnick = "%K{msgnick $0 $1-%K}%n";
# pubmsgmenick = "%K{msgnick $0 $1-%K}%n";
# pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n";
# ownprivmsgnick = "%K{msgnick $*%K}%n";
# privmsgnick = "%K{msgnick %R$*%K}%n";
# $0 = nick mode, $1 = nick
ownmsgnick = "{msgnick $0 $1-}";
ownnick = "%_$*%n";
# public message in channel, $0 = nick mode, $1 = nick
pubmsgnick = "{msgnick $0 $1-}";
pubnick = "%N$*%n";
# public message in channel meant for me, $0 = nick mode, $1 = nick
pubmsgmenick = "{msgnick $0 $1-}";
menick = "%Y$*%n";
# public highlighted message in channel
# $0 = highlight color, $1 = nick mode, $2 = nick
pubmsghinick = "{msgnick $1 $0$2-%n}";
# channel name is printed with message
msgchannel = "%K:%c$*%n";
# private message, $0 = nick, $1 = host
privmsg = "[%R$0%K(%r$1-%K)%n] ";
# private message from you, $0 = "msg", $1 = target nick
ownprivmsg = "[%r$0%K(%R$1-%K)%n] ";
# own private message in query
ownprivmsgnick = "{msgnick $*}";
ownprivnick = "%_$*%n";
# private message in query
privmsgnick = "{msgnick %R$*%n}";
##
## Actions (/ME stuff)
##
# used internally by this theme
action_core = "%_ * $*%n";
# generic one that's used by most actions
action = "{action_core $*} ";
# own action, both private/public
ownaction = "{action $*}";
# own action with target, both private/public
ownaction_target = "{action_core $0}%K:%c$1%n ";
# private action sent by others
pvtaction = "%_ (*) $*%n ";
pvtaction_query = "{action $*}";
# public action sent by others
pubaction = "{action $*}";
##
## other IRC events
##
# whois
whois = "%# $[8]0 : $1-";
# notices
ownnotice = "[%r$0%K(%R$1-%K)]%n ";
notice = "%K-%M$*%K-%n ";
pubnotice_channel = "%K:%m$*";
pvtnotice_host = "%K(%m$*%K)";
servernotice = "%g!$*%n ";
# CTCPs
ownctcp = "[%r$0%K(%R$1-%K)] ";
ctcp = "%g$*%n";
# wallops
wallop = "%_$*%n: ";
wallop_nick = "%n$*";
wallop_action = "%_ * $*%n ";
# netsplits
netsplit = "%R$*%n";
netjoin = "%C$*%n";
# /names list
names_prefix = "";
names_nick = "[%_$0%_$1-] ";
names_nick_op = "{names_nick $*}";
names_nick_halfop = "{names_nick $*}";
names_nick_voice = "{names_nick $*}";
names_users = "[%g$*%n]";
names_channel = "%G$*%n";
# DCC
dcc = "%g$*%n";
dccfile = "%_$*%_";
# DCC chat, own msg/action
dccownmsg = "[%r$0%K($1-%K)%n] ";
dccownnick = "%R$*%n";
dccownquerynick = "%_$*%n";
dccownaction = "{action $*}";
dccownaction_target = "{action_core $0}%K:%c$1%n ";
# DCC chat, others
dccmsg = "[%G$1-%K(%g$0%K)%n] ";
dccquerynick = "%G$*%n";
dccaction = "%_ (*dcc*) $*%n %|";
##
## statusbar
##
# default background for all statusbars. You can also give
# the default foreground color for statusbar items.
sb_background = "%4%w";
# default backround for "default" statusbar group
#sb_default_bg = "%4";
# background for prompt / input line
sb_prompt_bg = "%n";
# background for info statusbar
sb_info_bg = "%8";
# background for topicbar (same default)
#sb_topic_bg = "%4";
# text at the beginning of statusbars. "sb" already puts a space there,
# so we don't use anything by default.
sbstart = "";
# text at the end of statusbars. Use space so that it's never
# used for anything.
sbend = " ";
topicsbstart = "{sbstart $*}";
topicsbend = "{sbend $*}";
prompt = "[$*] ";
sb = " %c[%n$*%c]%n";
sbmode = "(%c+%n$*)";
sbaway = " (%GzZzZ%n)";
sbservertag = ":$0 (change with ^X)";
sbnickmode = "$0";
# activity in statusbar
# ',' separator
sb_act_sep = "%c$*";
# normal text
sb_act_text = "%c$*";
# public message
sb_act_msg = "%W$*";
# hilight
sb_act_hilight = "%M$*";
# hilight with specified color, $0 = color, $1 = text
sb_act_hilight_color = "$0$1-%n";
};

View File

@ -0,0 +1,220 @@
servers = (
{
address = "irc.libera.chat";
chatnet = "libera";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
autoconnect = "yes";
},
{ address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; }
);
chatnets = {
Libera = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
sasl_mechanism = "PLAIN";
sasl_username = "moebiusband";
sasl_password = "{{ (keepassxc "Libera chat").Password }}";
};
IRCnet = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
};
channels = (
{ name = "#irssi"; chatnet = "IRCNet"; autojoin = "no"; },
);
aliases = {
ATAG = "WINDOW SERVER";
ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
B = "BAN";
BACK = "AWAY";
BANS = "BAN";
BYE = "QUIT";
C = "CLEAR";
CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
CHAT = "DCC CHAT";
CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }";
DATE = "TIME";
DEHIGHLIGHT = "DEHILIGHT";
DESCRIBE = "ACTION";
DHL = "DEHILIGHT";
EXEMPTLIST = "MODE $C +e";
EXIT = "QUIT";
GOTO = "SCROLLBACK GOTO";
HIGHLIGHT = "HILIGHT";
HL = "HILIGHT";
HOST = "USERHOST";
INVITELIST = "MODE $C +I";
J = "JOIN";
K = "KICK";
KB = "KICKBAN";
KN = "KNOCKOUT";
LAST = "LASTLOG";
LEAVE = "PART";
M = "MSG";
MUB = "UNBAN *";
N = "NAMES";
NMSG = "^MSG";
P = "PART";
Q = "QUERY";
RESET = "SET -default";
RUN = "SCRIPT LOAD";
SAY = "MSG *";
SB = "SCROLLBACK";
SBAR = "STATUSBAR";
SIGNOFF = "QUIT";
SV = "MSG * Irssi $J ($V) - http://www.irssi.org";
T = "TOPIC";
UB = "UNBAN";
UMODE = "MODE $N";
UNSET = "SET -clear";
W = "WHO";
WC = "WINDOW CLOSE";
WG = "WINDOW GOTO";
WJOIN = "JOIN -window";
WI = "WHOIS";
WII = "WHOIS $0 $0";
WL = "WINDOW LIST";
WN = "WINDOW NEW HIDDEN";
WQUERY = "QUERY -window";
WW = "WHOWAS";
1 = "WINDOW GOTO 1";
2 = "WINDOW GOTO 2";
3 = "WINDOW GOTO 3";
4 = "WINDOW GOTO 4";
5 = "WINDOW GOTO 5";
6 = "WINDOW GOTO 6";
7 = "WINDOW GOTO 7";
8 = "WINDOW GOTO 8";
9 = "WINDOW GOTO 9";
};
statusbar = {
items = {
barstart = "{sbstart}";
barend = "{sbend}";
topicbarstart = "{topicsbstart}";
topicbarend = "{topicsbend}";
time = "{sb $Z}";
user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";
window = "{sb $winref:$tag/$itemname{sbmode $M}}";
window_empty = "{sb $winref{sbservertag $tag}}";
prompt = "{prompt $[.15]itemname}";
prompt_empty = "{prompt $winname}";
topic = " $topic";
topic_empty = " Irssi v$J - http://www.irssi.org";
lag = "{sb Lag: $0-}";
act = "{sb Act: $0-}";
more = "-- more --";
};
default = {
window = {
disabled = "no";
type = "window";
placement = "bottom";
position = "1";
visible = "active";
items = {
barstart = { priority = "100"; };
time = { };
user = { };
window = { };
window_empty = { };
lag = { priority = "-1"; };
act = { priority = "10"; };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
window_inact = {
type = "window";
placement = "bottom";
position = "1";
visible = "inactive";
items = {
barstart = { priority = "100"; };
window = { };
window_empty = { };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
prompt = {
type = "root";
placement = "bottom";
position = "100";
visible = "always";
items = {
prompt = { priority = "-1"; };
prompt_empty = { priority = "-1"; };
input = { priority = "10"; };
};
};
topic = {
type = "root";
placement = "top";
position = "1";
visible = "always";
items = {
topicbarstart = { priority = "100"; };
topic = { };
topic_empty = { };
topicbarend = { priority = "100"; alignment = "right"; };
};
};
};
};
settings = {
core = {
real_name = "jan";
user_name = "moebiusband";
nick = "moebiusband";
};
"fe-text" = { actlist_sort = "refnum"; };
"fe-common/core" = { theme = "bork"; autolog = "yes"; };
"perl/core/scripts" = {
neat_colorize = "yes";
neat_left_actions = "no";
neat_left_messages = "no";
neat_maxlength = "15";
neat_allow_shrinking = "yes";
neat_colors = "rRgGyYbBmMcC";
neat_right_mode = "yes";
neat_melength = "2";
awl_shared_sbar = "OFF";
awl_viewer = "no";
};
};
ignores = (
{ level = "JOINS PARTS QUITS NICKS"; channels = ( "#symfony", "#perl", "#openbsd" ); }
);

File diff suppressed because it is too large Load Diff

693
dot_irssi/scripts/nm.pl Normal file
View File

@ -0,0 +1,693 @@
use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION="0.3.10";
%IRSSI = (
authors=> 'BC-bd',
contact=> 'bd@bc-bd.org',
name=> 'nm',
description=> 'right aligned nicks depending on longest nick',
license=> 'GPL v2',
url=> 'http://bc-bd.org/blog/irssi/',
);
# $Id: 9cb009e8b7e6f5ce60294334faf88715ef01413e $
# nm.pl
# for irssi 0.8.4 by bd@bc-bd.org
#
# right aligned nicks depending on longest nick
#
# inspired by neatmsg.pl from kodgehopper <kodgehopper@netscape.net
# formats taken from www.irssi.de
# thanks to adrianel <adrinael@nuclearzone.org> for some hints
# thanks to Eric Wald <eswald@gmail.com> for the left alignment patch
# inspired by nickcolor.pl by Timo Sirainen and Ian Peters
# thanks to And1 <and1@meinungsverstaerker.de> for a small patch
# thanks to berber@tzi.de for the save/load patch
# thanks to Dennis Heimbert <dennis.heimbert@gmail.com> for a bug report/patch
# thanks to Roy Sigurd Karlsbakk <roy@karlsbakk.net> for an autosave patch
#
#########
# USAGE
###
#
# use
#
# /neatcolor help
#
# for help on available commands
#
#########
# OPTIONS
#########
my $help = "
/set neat_colorize <ON|OFF>
* ON : colorize nicks
* OFF : do not colorize nicks
/set neat_colors <string>
Use these colors when colorizing nicks, eg:
/set neat_colors yYrR
See the file formats.txt on an explanation of what colors are
available.
/set neat_left_actions <ON|OFF>
* ON : print nicks left-aligned on actions
* OFF : print nicks right-aligned on actions
/set neat_left_messages <ON|OFF>
* ON : print nicks left-aligned on messages
* OFF : print nicks right-aligned on messages
/set neat_right_mode <ON|OFF>
* ON : print the mode of the nick e.g @%+ after the nick
* OFF : print it left of the nick
/set neat_maxlength <number>
* number : Maximum length of Nicks to display. Longer nicks are truncated.
* 0 : Do not truncate nicks.
/set neat_melength <number>
* number : number of spaces to substract from /me padding
/set neat_ignorechars <str>
* str : regular expression used to filter out unwanted characters in
nicks. this can be used to assign the same color for similar
nicks, e.g. foo and foo_:
/set neat_ignorechars [_]
/set neat_allow_shrinking <ON|OFF>
* ON : shrink padding when longest nick disappears
* OFF : do not shrink, only allow growing
/set neat_autosave <number>
* number : autosave after <number> seconds, defaults to 60. Set to 0 to
disable.
";
#
###
################
###
#
# Changelog
#
# Version 0.3.11
# - added autosave, idea from Roy Sigurd Karlsbakk
#
# Version 0.3.10
# - fix losing of saved color when changing nick shares more than one channel
# with you
#
# Version 0.3.9
# - fix longest nick calculation for nicks shorter than the current longest
# nick
# - updated url
#
# Version 0.3.8
# - fixed error in the nickchange tracking code, reported by Kevin Ballard
# - added --all switch to reset command
# - skip broken lines in saved_colors
#
# Version 0.3.7
# - fixed crash when calling /neatcolor without parameters
# - fixed url
#
# Version 0.3.6
# - added option to ignore certain characters from color hash building, see
# https://bc-bd.org/trac/irssi/ticket/22
# - added option to save and specify colors for nicks, see
# https://bc-bd.org/trac/irssi/ticket/23
# - added option to disallow shrinking, see
# https://bc-bd.org/trac/irssi/ticket/12
#
# Version 0.3.5
# - now also aligning own messages in queries
#
# Version 0.3.4
# - fxed off by one error in nick_to_color, patch by jrib, see
# https://bc-bd.org/trac/irssi/ticket/24
#
# Version 0.3.3
# - added support for alignment in queries, see
# https://bc-bd.org/trac/irssi/ticket/21
#
# Version 0.3.2
# - integrated left alignment patch from Eric Wald <eswald@gmail.com>, see
# https://bc-bd.org/trac/irssi/ticket/18
#
# Version 0.3.1
# - /me padding, see https://bc-bd.org/trac/irssi/ticket/17
#
# Version 0.3.0
# - integrate nick coloring support
#
# Version 0.2.1
# - moved neat_maxlength check to reformat() (thx to Jerome De Greef <jdegreef@brutele.be>)
#
# Version 0.2.0
# - by adrianel <adrinael@nuclearzone.org>
# * reformat after setup reload
# * maximum length of nicks
#
# Version 0.1.0
# - got lost somewhere
#
# Version 0.0.2
# - ugly typo fixed
#
# Version 0.0.1
# - initial release
#
###
################
###
#
# BUGS
#
# Empty nicks, eg "<> message"
# This seems to be triggered by some themes. As of now there is no known
# fix other than changing themes, see
# https://bc-bd.org/trac/irssi/ticket/19
#
# Well, it's a feature: due to the lacking support of extendable themes
# from irssi it is not possible to just change some formats per window.
# This means that right now all windows are aligned with the same nick
# length, which can be somewhat annoying.
# If irssi supports extendable themes, I will include per-server indenting
# and a setting where you can specify servers you don't want to be indented
#
###
################
my ($longestNick, %saved_colors, @colors, $alignment, $sign, %commands,);
my ($pending_save);
my $colorize = -1;
sub reformat() {
my $max = Irssi::settings_get_int('neat_maxlength');
my $actsign = Irssi::settings_get_bool('neat_left_actions')? '': '-';
$sign = Irssi::settings_get_bool('neat_left_messages')? '': '-';
if ($max && $max < $longestNick) {
$longestNick = $max;
}
my $me = $longestNick - Irssi::settings_get_int('neat_melength');
$me = 0 if ($me < 0);
Irssi::command('^format own_action {ownaction $['.$actsign.$me.']0} $1');
Irssi::command('^format action_public {pubaction $['.$actsign.$me.']0}$1');
Irssi::command('^format action_private {pvtaction $['.$actsign.$me.']0}$1');
Irssi::command('^format action_private_query {pvtaction_query $['.$actsign.$me.']0} $2');
my $length = $sign . $longestNick;
if (Irssi::settings_get_bool('neat_right_mode') == 0) {
Irssi::command('^format own_msg {ownmsgnick $2 {ownnick $['.$length.']0}}$1');
Irssi::command('^format own_msg_channel {ownmsgnick $3 {ownnick $['.$length.']0}{msgchannel $1}}$2');
Irssi::command('^format pubmsg_me {pubmsgmenick $2 {menick $['.$length.']0}}$1');
Irssi::command('^format pubmsg_me_channel {pubmsgmenick $3 {menick $['.$length.']0}{msgchannel $1}}$2');
Irssi::command('^format pubmsg_hilight {pubmsghinick $0 $3 $['.$length.']1%n}$2');
Irssi::command('^format pubmsg_hilight_channel {pubmsghinick $0 $4 $['.$length.']1{msgchannel $2}}$3');
Irssi::command('^format pubmsg {pubmsgnick $2 {pubnick $['.$length.']0}}$1');
Irssi::command('^format pubmsg_channel {pubmsgnick $2 {pubnick $['.$length.']0}}$1');
} else {
Irssi::command('^format own_msg {ownmsgnick {ownnick $['.$length.']0$2}}$1');
Irssi::command('^format own_msg_channel {ownmsgnick {ownnick $['.$length.']0$3}{msgchannel $1}}$2');
Irssi::command('^format pubmsg_me {pubmsgmenick {menick $['.$length.']0}$2}$1');
Irssi::command('^format pubmsg_me_channel {pubmsgmenick {menick $['.$length.']0$3}{msgchannel $1}}$2');
Irssi::command('^format pubmsg_hilight {pubmsghinick $0 $0 $['.$length.']1$3%n}$2');
Irssi::command('^format pubmsg_hilight_channel {pubmsghinick $0 $['.$length.']1$4{msgchannel $2}}$3');
Irssi::command('^format pubmsg {pubmsgnick {pubnick $['.$length.']0$2}}$1');
Irssi::command('^format pubmsg_channel {pubmsgnick {pubnick $['.$length.']0$2}}$1');
}
# format queries
Irssi::command('^format own_msg_private_query {ownprivmsgnick {ownprivnick $['.$length.']2}}$1');
Irssi::command('^format msg_private_query {privmsgnick $['.$length.']0}$2');
};
sub findLongestNick {
$longestNick = 0;
# get own nick length
map {
my $len = length($_->{nick});
$longestNick = $len if ($len > $longestNick);
} Irssi::servers();
# find longest other nick
foreach (Irssi::channels()) {
foreach ($_->nicks()) {
my $len = length($_->{nick});
$longestNick = $len if ($len > $longestNick);
}
}
reformat();
}
sub delayed_save
{
# skip if we have already a save pending. we don't reset the timeout
# here, else you could end up with changes never being automatically
# saved if they happen more often than <neat_autosave> seconds
return if $pending_save;
return unless Irssi::settings_get_int('neat_autosave');
Irssi::timeout_add_once(Irssi::settings_get_int('neat_autosave') * 1000,
\&save_colors, undef);
}
# a new nick was created
sub sig_newNick
{
my ($channel, $nick) = @_;
my $len = length($nick->{nick});
if ($len > $longestNick) {
$longestNick = $len;
reformat();
}
return if (exists($saved_colors{$nick->{nick}}));
$saved_colors{$nick->{nick}} = "%".nick_to_color($nick->{nick});
delayed_save();
}
# something changed
sub sig_changeNick
{
my ($channel, $nick, $old_nick) = @_;
# if no saved color exists, we already handled this nickchange. irssi
# generates one signal per channel the nick is in, so if you share more
# than one channel with this nick, you'd lose the coloring.
return unless exists($saved_colors{$old_nick});
# we need to update the saved colorors hash independent of nick lenght
$saved_colors{$nick->{nick}} = $saved_colors{$old_nick};
delete $saved_colors{$old_nick};
delayed_save();
my $new = length($nick->{nick});
# in case the new nick is longer than the old one, simply remember this
# as the new longest nick and reformat.
#
# if the new nick is as long as the known longest nick nothing has to be
# done
#
# if the new nick is shorter than the current longest one and if the
# user allows us to shrink, find new longest nick and reformat.
if ($new > $longestNick) {
$longestNick = $new;
} elsif ($new == $longestNick) {
return;
} else {
return unless Irssi::settings_get_bool('neat_allow_shrinking');
findLongestNick();
}
reformat();
}
sub sig_removeNick
{
my ($channel, $nick) = @_;
my $thisLen = length($nick->{nick});
# we only need to recalculate if this was the longest nick and we are
# allowed to shrink
if ($thisLen == $longestNick && Irssi::settings_get_bool('neat_allow_shrinking')) {
findLongestNick();
reformat();
}
# we do not remove a known color for a gone nick, as they may return
}
# based on simple_hash from nickcolor.pl
sub nick_to_color($) {
my ($string) = @_;
chomp $string;
my $ignore = Irssi::settings_get_str("neat_ignorechars");
$string =~ s/$ignore//g;
my $counter;
foreach my $char (split(//, $string)) {
$counter += ord $char;
}
return $colors[$counter % ($#colors + 1)];
}
sub color_left($) {
Irssi::command('^format pubmsg {pubmsgnick $2 {pubnick '.$_[0].'$['.$sign.$longestNick.']0}}$1');
Irssi::command('^format pubmsg_channel {pubmsgnick $2 {pubnick '.$_[0].'$['.$sign.$longestNick.']0}}$1');
}
sub color_right($) {
Irssi::command('^format pubmsg {pubmsgnick {pubnick '.$_[0].'$['.$sign.$longestNick.']0}$2}$1');
Irssi::command('^format pubmsg_channel {pubmsgnick {pubnick '.$_[0].'$['.$sign.$longestNick.']0}$2}$1');
}
sub sig_public {
my ($server, $msg, $nick, $address, $target) = @_;
&$alignment($saved_colors{$nick});
}
sub sig_setup {
@colors = split(//, Irssi::settings_get_str('neat_colors'));
# check left or right alignment
if (Irssi::settings_get_bool('neat_right_mode') == 0) {
$alignment = \&color_left;
} else {
$alignment = \&color_right;
}
# check if we switched coloring on or off
my $new = Irssi::settings_get_bool('neat_colorize');
if ($new != $colorize) {
if ($new) {
Irssi::signal_add('message public', 'sig_public');
} else {
if ($colorize >= 0) {
Irssi::signal_remove('message public', 'sig_public');
}
}
}
$colorize = $new;
reformat();
&$alignment('%w');
}
# make sure that every nick has an assigned color
sub assert_colors() {
foreach (Irssi::channels()) {
foreach ($_->nicks()) {
next if (exists($saved_colors{$_->{nick}}));
$saved_colors{$_->{nick}} = "%".nick_to_color($_->{nick});
delayed_save();
}
}
}
# load colors from file
sub load_colors() {
open(FID, "<", $ENV{HOME}."/.irssi/saved_colors") || return;
while (<FID>) {
chomp;
my ($k, $v) = split(/:/);
# skip broken lines, those may have been introduced by nm.pl
# version 0.3.7 and earlier
if ($k eq '' || $v eq '') {
neat_log(Irssi::active_win(), "Warning, broken line in saved_colors file, skipping '$k:$v'");
next;
}
$saved_colors{$k} = $v;
}
close(FID);
}
# save colors to file
sub save_colors() {
open(FID, ">", $ENV{HOME}."/.irssi/saved_colors");
print FID $_.":".$saved_colors{$_}."\n" foreach (keys(%saved_colors));
close(FID);
# clear possible pending save.
Irssi::timeout_remove($pending_save) if $pending_save;
$pending_save = undef;
}
# log a line to a window item
sub neat_log($@) {
my ($witem, @text) = @_;
$witem->print("nm.pl: ".$_) foreach(@text);
}
# show available colors
sub cmd_neatcolor_colors($) {
my ($witem, undef, undef) = @_;
neat_log($witem, "Available colors: ".join("", map { "%".$_.$_ } @colors));
}
# display the configured color for a nick
sub cmd_neatcolor_get() {
my ($witem, $nick, undef) = @_;
if (!exists($saved_colors{$nick})) {
neat_log($witem, "Error: no such nick '$nick'");
return;
}
neat_log($witem, "Color for ".$saved_colors{$nick}.$nick);
}
# display help
sub cmd_neatcolor_help() {
my ($witem, $cmd, undef) = @_;
if ($cmd) {
if (!exists($commands{$cmd})) {
neat_log($witem, "Error: no such command '$cmd'");
return;
}
if (!exists($commands{$cmd}{verbose})) {
neat_log($witem, "No additional help for '$cmd' available");
return;
}
neat_log($witem, ( "", "Help for ".uc($cmd), "" ) );
neat_log($witem, @{$commands{$cmd}{verbose}});
return;
}
neat_log($witem, split(/\n/, $help));
neat_log($witem, "Available options for /neatcolor");
neat_log($witem, " ".$_.": ".$commands{$_}{text}) foreach(sort(keys(%commands)));
my @verbose;
foreach (sort(keys(%commands))) {
push(@verbose, $_) if exists($commands{$_}{verbose});
}
neat_log($witem, "Verbose help available for: '".join(", ", @verbose)."'");
}
# list configured nicks
sub cmd_neatcolor_list() {
my ($witem, undef, undef) = @_;
neat_log($witem, "Configured nicks: ".join(", ", map { $saved_colors{$_}.$_ } sort(keys(%saved_colors))));
}
# reset a nick to its default color
sub cmd_neatcolor_reset() {
my ($witem, $nick, undef) = @_;
if ($nick eq '--all') {
%saved_colors = ();
assert_colors();
neat_log($witem, "Reset all colors");
return;
}
if (!exists($saved_colors{$nick})) {
neat_log($witem, "Error: no such nick '$nick'");
return;
}
$saved_colors{$nick} = "%".nick_to_color($nick);
delayed_save();
neat_log($witem, "Reset color for ".$saved_colors{$nick}.$nick);
}
# save configured colors to disk
sub cmd_neatcolor_save() {
my ($witem, undef, undef) = @_;
save_colors();
neat_log($witem, "color information saved");
}
# set a color for a nick
sub cmd_neatcolor_set() {
my ($witem, $nick, $color) = @_;
my @found = grep(/$color/, @colors);
if ($#found) {
neat_log($witem, "Error: trying to set unknown color '%$color$color%n'");
cmd_neatcolor_colors($witem);
return;
}
if ($witem->{type} ne "CHANNEL" && $witem->{type} ne "QUERY") {
neat_log($witem, "Warning: not a Channel/Query, can not check nick!");
neat_log($witem, "Remember, nicks are case sensitive to nm.pl");
} else {
my @nicks = grep(/^$nick$/i, map { $_->{nick} } ($witem->nicks()));
if ($#nicks < 0) {
neat_log($witem, "Warning: could not find nick '$nick' here");
} else {
if ($nicks[0] ne $nick) {
neat_log($witem, "Warning: using '$nicks[0]' instead of '$nick'");
$nick = $nicks[0];
}
}
}
$saved_colors{$nick} = "%".$color;
delayed_save();
neat_log($witem, "Set color for $saved_colors{$nick}$nick");
}
%commands = (
colors => {
text => "show available colors",
verbose => [
"COLORS",
"",
"displays all available colors",
"",
"You can restrict/define the list of available colors ".
"with the help of the neat_colors setting"
],
func => \&cmd_neatcolor_colors,
},
get => {
text => "retrieve color for a nick",
verbose => [
"GET <nick>",
"",
"displays color used for <nick>"
],
func => \&cmd_neatcolor_get,
},
help => {
text => "print this help message",
func => \&cmd_neatcolor_help,
},
list => {
text => "list configured nick/color pairs",
func => \&cmd_neatcolor_list,
},
reset => {
text => "reset color to default",
verbose => [
"RESET --all|<nick>",
"",
"resets the color used for all nicks or for <nick> to ",
"its internal default",
],
func => \&cmd_neatcolor_reset,
},
save => {
text => "save color information to disk",
verbose => [
"SAVE",
"",
"saves color information to disk, so that it survives ".
"an irssi restart.",
"",
"Color information will be automatically saved on /quit",
],
func => \&cmd_neatcolor_save,
},
set => {
text => "set a specific color for a nick",
verbose => [
"SET <nick> <color>",
"",
"use <color> for <nick>",
"",
"This command will perform a couple of sanity checks, ".
"when called from a CHANNEL/QUERY window",
"",
"EXAMPLE:",
" /neatcolor set bc-bd r",
"",
"use /neatcolor COLORS to see available colors"
],
func => \&cmd_neatcolor_set,
},
);
# the main command callback that gets called for all neatcolor commands
sub cmd_neatcolor() {
my ($data, $server, $witem) = @_;
my ($cmd, $nick, $color) = split (/ /, $data);
$cmd = lc($cmd);
# make sure we have a valid witem to print text to
$witem = Irssi::active_win() unless ($witem);
if (!exists($commands{$cmd})) {
neat_log($witem, "Error: unknown command '$cmd'");
&{$commands{"help"}{"func"}}($witem) if (exists($commands{"help"}));
return;
}
&{$commands{$cmd}{"func"}}($witem, $nick, $color);
}
Irssi::settings_add_bool('misc', 'neat_left_messages', 0);
Irssi::settings_add_bool('misc', 'neat_left_actions', 0);
Irssi::settings_add_bool('misc', 'neat_right_mode', 1);
Irssi::settings_add_int('misc', 'neat_maxlength', 0);
Irssi::settings_add_int('misc', 'neat_melength', 2);
Irssi::settings_add_bool('misc', 'neat_colorize', 1);
Irssi::settings_add_str('misc', 'neat_colors', 'rRgGyYbBmMcC');
Irssi::settings_add_str('misc', 'neat_ignorechars', '');
Irssi::settings_add_bool('misc', 'neat_allow_shrinking', 1);
Irssi::settings_add_int('misc', 'neat_autosave', 60);
Irssi::command_bind('neatcolor', 'cmd_neatcolor');
Irssi::signal_add('nicklist new', 'sig_newNick');
Irssi::signal_add('nicklist changed', 'sig_changeNick');
Irssi::signal_add('nicklist remove', 'sig_removeNick');
Irssi::signal_add('setup changed', 'sig_setup');
Irssi::signal_add_last('setup reread', 'sig_setup');
findLongestNick();
sig_setup;
load_colors();
assert_colors();
# we need to add this signal _after_ the colors have been loaded, to make sure
# no race condition exists wrt color saving
Irssi::signal_add('gui exit', 'save_colors');

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,579 @@
## trackbar.pl
#
# This little script will do just one thing: it will draw a line each time you
# switch away from a window. This way, you always know just upto where you've
# been reading that window :) It also removes the previous drawn line, so you
# don't see double lines.
#
# redraw trackbar only works on irssi 0.8.17 or higher.
#
##
## Usage:
#
# The script works right out of the box, but if you want you can change
# the working by /set'ing the following variables:
#
# Setting: trackbar_style
# Description: This setting will be the color of your trackbar line.
# By default the value will be '%K', only Irssi color
# formats are allowed. If you don't know the color formats
# by heart, you can take a look at the formats documentation.
# You will find the proper docs on http://www.irssi.org/docs.
#
# Setting: trackbar_string
# Description: This is the string that your line will display. This can
# be multiple characters or just one. For example: '~-~-'
# The default setting is '-'.
# Here are some unicode characters you can try:
# "───" => U+2500 => a line
# "═══" => U+2550 => a double line
# "━━━" => U+2501 => a wide line
# "▭ " => U+25ad => a white rectangle
#
# Setting: trackbar_use_status_window
# Description: If this setting is set to OFF, Irssi won't print a trackbar
# in the statuswindow
#
# Setting: trackbar_ignore_windows
# Description: A list of windows where no trackbar should be printed
#
# Setting: trackbar_print_timestamp
# Description: If this setting is set to ON, Irssi will print the formatted
# timestamp in front of the trackbar.
#
# Setting: trackbar_require_seen
# Description: Only clear the trackbar if it has been scrolled to.
#
# /mark is a command that will redraw the line at the bottom.
#
# Command: /trackbar, /trackbar goto
# Description: Jump to where the trackbar is, to pick up reading
#
# Command: /trackbar keep
# Description: Keep this window's trackbar where it is the next time
# you switch windows (then this flag is cleared again)
#
# Command: /mark, /trackbar mark
# Description: Remove the old trackbar and mark the bottom of this
# window with a new trackbar
#
# Command: /trackbar markvisible
# Description: Like mark for all visible windows
#
# Command: /trackbar markall
# Description: Like mark for all windows
#
# Command: /trackbar remove
# Description: Remove this window's trackbar
#
# Command: /trackbar removeall
# Description: Remove all windows' trackbars
#
# Command: /trackbar redraw
# Description: Force redraw of trackbars
#
##
##
#
# For bugreports and other improvements contact one of the authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
##
use strict;
use warnings;
use vars qw($VERSION %IRSSI);
$VERSION = "2.5"; # 56e983314dc1b85
%IRSSI = (
authors => "Peter 'kinlo' Leurs, Uwe Dudenhoeffer, " .
"Michiel Holtkamp, Nico R. Wohlgemuth, " .
"Geert Hauwaerts",
contact => 'peter@pfoe.be',
patchers => 'Johan Kiviniemi (UTF-8), Uwe Dudenhoeffer (on-upgrade-remove-line)',
name => 'trackbar',
description => 'Shows a bar where you have last read a window.',
license => 'GNU General Public License',
url => 'http://www.pfoe.be/~peter/trackbar/',
commands => 'trackbar',
);
## Comments and remarks.
#
# This script uses settings.
# Use /SET to change the value or /TOGGLE to switch it on or off.
#
#
# Tip: The command 'trackbar' is very usefull if you bind that to a key,
# so you can easily jump to the trackbar. Please see 'help bind' for
# more information about keybindings in Irssi.
#
# Command: /BIND meta2-P key F1
# /BIND F1 command trackbar
#
##
## Bugfixes and new items in this rewrite.
#
# * Remove all the trackbars before upgrading.
# * New setting trackbar_use_status_window to control the statuswindow trackbar.
# * New setting trackbar_print_timestamp to print a timestamp or not.
# * New command 'trackbar' to scroll up to the trackbar.
# * When resizing your terminal, Irssi will update all the trackbars to the new size.
# * When changing trackbar settings, change all the trackbars to the new settings.
# * New command 'trackbar mark' to draw a new trackbar (The old '/mark').
# * New command 'trackbar markall' to draw a new trackbar in each window.
# * New command 'trackbar remove' to remove the trackbar from the current window.
# * New command 'trackbar removeall' to remove all the trackbars.
# * Don't draw a trackbar in empty windows.
# * Added a version check to prevent Irssi redraw errors.
# * Fixed a bookmark NULL versus 0 bug.
# * Fixed a remove-line bug in Uwe Dudenhoeffer his patch.
# * New command 'help trackbar' to display the trackbar commands.
# * Fixed an Irssi startup bug, now processing each auto-created window.
#
##
## Known bugs and the todolist.
#
# Todo: * Instead of drawing a line, invert the line.
#
##
## Authors:
#
# - Main maintainer & author: Peter 'kinlo' Leurs
# - Many thanks to Timo 'cras' Sirainen for placing me on my way
# - on-upgrade-remove-line patch by Uwe Dudenhoeffer
# - trackbar resizing by Michiel Holtkamp (02 Jul 2012)
# - scroll to trackbar, window excludes, and timestamp options by Nico R.
# Wohlgemuth (22 Sep 2012)
#
##
## Version history:
#
# 2.5: - merge back on scripts.irssi.org
# - fix /trackbar redraw broken in 2.4
# - fix legacy encodings
# - add workaround for irssi issue #271
# 2.4: - add support for horizontal splits
# 2.3: - add some features for seen tracking using other scripts
# 2.0: - big rewrite based on 1.4
# * removed /tb, you can have it with /alias tb trackbar if you want
# * subcommand and settings changes:
# /trackbar vmark => /trackbar markvisible
# /trackbar scroll => /trackbar goto (or just /trackbar)
# /trackbar help => /help trackbar
# /set trackbar_hide_windows => /set trackbar_ignore_windows
# /set trackbar_timestamp => /set trackbar_print_timestamp
# * magic line strings were removed, just paste the unicode you want!
# * trackbar_timestamp_styled is not currently supported
# 1.9: - add version guard
# 1.8: - sub draw_bar
# 1.7: - Added /tb scroll, trackbar_hide_windows, trackbar_timestamp_timestamp
# and trackbar_timestamp_styled
# 1.6: - Work around Irssi resize bug, please do /upgrade! (see below)
# 1.5: - Resize trackbars in all windows when terminal is resized
# 1.4: - Changed our's by my's so the irssi script header is valid
# - Removed utf-8 support. In theory, the script should work w/o any
# problems for utf-8, just set trackbar_string to a valid utf-8 character
# and everything *should* work. However, this script is being plagued by
# irssi internal bugs. The function Irssi::settings_get_str does NOT handle
# unicode strings properly, hence you will notice problems when setting the bar
# to a unicode char. For changing your bar to utf-8 symbols, read the line sub.
# 1.3: - Upgrade now removes the trackbars.
# - Some code cleanups, other defaults
# - /mark sets the line to the bottom
# 1.2: - Support for utf-8
# - How the bar looks can now be configured with trackbar_string
# and trackbar_style
# 1.1: - Fixed bug when closing window
# 1.0: - Initial release
#
##
use Irssi;
use Irssi::TextUI;
use Encode;
use POSIX qw(strftime);
sub cmd_help {
my ($args) = @_;
if ($args =~ /^trackbar *$/i) {
print CLIENTCRAP <<HELP
%9Syntax:%9
TRACKBAR
TRACKBAR GOTO
TRACKBAR KEEP
TRACKBAR MARK
TRACKBAR MARKVISIBLE
TRACKBAR MARKALL
TRACKBAR REMOVE
TRACKBAR REMOVEALL
TRACKBAR REDRAW
%9Parameters:%9
GOTO: Jump to where the trackbar is, to pick up reading
KEEP: Keep this window's trackbar where it is the next time
you switch windows (then this flag is cleared again)
MARK: Remove the old trackbar and mark the bottom of this
window with a new trackbar
MARKVISIBLE: Like mark for all visible windows
MARKALL: Like mark for all windows
REMOVE: Remove this window's trackbar
REMOVEALL: Remove all windows' trackbars
REDRAW: Force redraw of trackbars
%9Description:%9
Manage a trackbar. Without arguments, it will scroll up to the trackbar.
%9Examples:%9
/TRACKBAR MARK
/TRACKBAR REMOVE
HELP
}
}
Irssi::theme_register([
'trackbar_loaded', '%R>>%n %_Scriptinfo:%_ Loaded $0 version $1 by $2.',
'trackbar_wrong_version', '%R>>%n %_Trackbar:%_ Please upgrade your client to 0.8.17 or above if you would like to use this feature of trackbar.',
'trackbar_all_removed', '%R>>%n %_Trackbar:%_ All the trackbars have been removed.',
'trackbar_not_found', '%R>>%n %_Trackbar:%_ No trackbar found in this window.',
]);
my $old_irssi = Irssi::version < 20140701;
sub check_version {
if ($old_irssi) {
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_wrong_version');
return;
} else {
return 1;
}
}
sub is_utf8 {
lc Irssi::settings_get_str('term_charset') eq 'utf-8'
}
my (%config, %keep_trackbar, %unseen_trackbar);
sub remove_one_trackbar {
my $win = shift;
my $view = shift || $win->view;
my $line = $view->get_bookmark('trackbar');
if (defined $line) {
my $bottom = $view->{bottom};
$view->remove_line($line);
$win->command('^scrollback end') if $bottom && !$win->view->{bottom};
$view->redraw;
}
}
sub add_one_trackbar {
my $win = shift;
my $view = shift || $win->view;
$win->print(line($win->{width}), MSGLEVEL_NEVER);
$view->set_bookmark_bottom('trackbar');
$unseen_trackbar{ $win->{_irssi} } = 1;
Irssi::signal_emit("window trackbar added", $win);
$view->redraw;
}
sub update_one_trackbar {
my $win = shift;
my $view = shift || $win->view;
my $force = shift;
my $ignored = win_ignored($win, $view);
remove_one_trackbar($win, $view)
if $force || !defined $force || !$ignored;
add_one_trackbar($win, $view)
if $force || !$ignored;
}
sub win_ignored {
my $win = shift;
my $view = shift || $win->view;
return 1 unless $view->{buffer}{lines_count};
return 1 if $win->{name} eq '(status)' && !$config{use_status_window};
no warnings 'uninitialized';
return 1 if grep { $win->{name} eq $_ || $win->{refnum} eq $_
|| $win->get_active_name eq $_ } @{ $config{ignore_windows} };
return 0;
}
sub sig_window_changed {
my ($newwindow, $oldwindow) = @_;
return unless $oldwindow;
redraw_one_trackbar($newwindow) unless $old_irssi;
trackbar_update_seen($newwindow);
return if delete $keep_trackbar{ $oldwindow->{_irssi} };
trackbar_update_seen($oldwindow);
return if $config{require_seen} && $unseen_trackbar{ $oldwindow->{_irssi } };
update_one_trackbar($oldwindow, undef, 0);
}
sub trackbar_update_seen {
my $win = shift;
return unless $win;
return unless $unseen_trackbar{ $win->{_irssi} };
my $view = $win->view;
my $line = $view->get_bookmark('trackbar');
unless ($line) {
delete $unseen_trackbar{ $win->{_irssi} };
Irssi::signal_emit("window trackbar seen", $win);
return;
}
my $startline = $view->{startline};
return unless $startline;
if ($startline->{info}{time} < $line->{info}{time}
|| $startline->{_irssi} == $line->{_irssi}) {
delete $unseen_trackbar{ $win->{_irssi} };
Irssi::signal_emit("window trackbar seen", $win);
}
}
sub screen_length;
{ local $@;
eval { require Text::CharWidth; };
unless ($@) {
*screen_length = sub { Text::CharWidth::mbswidth($_[0]) };
}
else {
*screen_length = sub {
my $temp = shift;
Encode::_utf8_on($temp) if is_utf8();
length($temp)
};
}
}
{ my %strip_table = (
(map { $_ => '' } (split //, '04261537' . 'kbgcrmyw' . 'KBGCRMYW' . 'U9_8I:|FnN>#[' . 'pP')),
(map { $_ => $_ } (split //, '{}%')),
);
sub c_length {
my $o = Irssi::strip_codes($_[0]);
$o =~ s/(%(%|Z.{6}|z.{6}|X..|x..|.))/exists $strip_table{$2} ? $strip_table{$2} :
$2 =~ m{x(?:0[a-f]|[1-6][0-9a-z]|7[a-x])|z[0-9a-f]{6}}i ? '' : $1/gex;
screen_length($o)
}
}
sub line {
my ($width, $time) = @_;
my $string = $config{string};
$string = ' ' unless length $string;
$time ||= time;
Encode::_utf8_on($string) if is_utf8();
my $length = c_length($string);
my $format = '';
if ($config{print_timestamp}) {
$format = $config{timestamp_str};
$format =~ y/%/\01/;
$format =~ s/\01\01/%/g;
$format = strftime($format, localtime $time);
$format =~ y/\01/%/;
}
my $times = $width / $length;
$times += 1 if $times != int $times;
my $style = "$config{style}";
Encode::_utf8_on($style) if is_utf8();
$format .= $style;
$width -= c_length($format);
$string x= $times;
chop $string while length $string && c_length($string) > $width;
return $format . $string;
}
sub remove_all_trackbars {
for my $window (Irssi::windows) {
next unless ref $window;
remove_one_trackbar($window);
}
}
sub UNLOAD {
remove_all_trackbars();
}
sub redraw_one_trackbar {
my $win = shift;
my $view = $win->view;
my $line = $view->get_bookmark('trackbar');
return unless $line;
my $bottom = $view->{bottom};
$win->print_after($line, MSGLEVEL_NEVER, line($win->{width}, $line->{info}{time}),
$line->{info}{time});
$view->set_bookmark('trackbar', $win->last_line_insert);
$view->remove_line($line);
$win->command('^scrollback end') if $bottom && !$win->view->{bottom};
$view->redraw;
}
sub redraw_trackbars {
return unless check_version();
for my $win (Irssi::windows) {
next unless ref $win;
redraw_one_trackbar($win);
}
}
sub goto_trackbar {
my $win = Irssi::active_win;
my $line = $win->view->get_bookmark('trackbar');
if ($line) {
$win->command("scrollback goto ". strftime("%d %H:%M:%S", localtime($line->{info}{time})));
} else {
$win->printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_not_found');
}
}
sub cmd_mark {
update_one_trackbar(Irssi::active_win, undef, 1);
}
sub cmd_markall {
for my $window (Irssi::windows) {
next unless ref $window;
update_one_trackbar($window);
}
}
sub signal_stop {
Irssi::signal_stop;
}
sub cmd_markvisible {
my @wins = Irssi::windows;
my $awin =
my $bwin = Irssi::active_win;
my $awin_counter = 0;
Irssi::signal_add_priority('window changed' => 'signal_stop', -99);
do {
Irssi::active_win->command('window up');
$awin = Irssi::active_win;
update_one_trackbar($awin);
++$awin_counter;
} until ($awin->{refnum} == $bwin->{refnum} || $awin_counter >= @wins);
Irssi::signal_remove('window changed' => 'signal_stop');
}
sub cmd_trackbar_remove_one {
remove_one_trackbar(Irssi::active_win);
}
sub cmd_remove_all_trackbars {
remove_all_trackbars();
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_all_removed');
}
sub cmd_keep_once {
$keep_trackbar{ Irssi::active_win->{_irssi} } = 1;
}
sub trackbar_runsub {
my ($data, $server, $item) = @_;
$data =~ s/\s+$//g;
if ($data) {
Irssi::command_runsub('trackbar', $data, $server, $item);
} else {
goto_trackbar();
}
}
sub update_config {
my $was_status_window = $config{use_status_window};
$config{style} = Irssi::settings_get_str('trackbar_style');
$config{string} = Irssi::settings_get_str('trackbar_string');
$config{require_seen} = Irssi::settings_get_bool('trackbar_require_seen');
$config{ignore_windows} = [ split /[,\s]+/, Irssi::settings_get_str('trackbar_ignore_windows') ];
$config{use_status_window} = Irssi::settings_get_bool('trackbar_use_status_window');
$config{print_timestamp} = Irssi::settings_get_bool('trackbar_print_timestamp');
if (defined $was_status_window && $was_status_window != $config{use_status_window}) {
if (my $swin = Irssi::window_find_name('(status)')) {
if ($config{use_status_window}) {
update_one_trackbar($swin);
}
else {
remove_one_trackbar($swin);
}
}
}
if ($config{print_timestamp}) {
my $ts_format = Irssi::settings_get_str('timestamp_format');
my $ts_theme = Irssi::current_theme->get_format('fe-common/core', 'timestamp');
my $render_str = Irssi::current_theme->format_expand($ts_theme);
(my $ts_escaped = $ts_format) =~ s/([%\$])/$1$1/g;
$render_str =~ s/(?|\$(.)(?!\w)|\$\{(\w+)\})/$1 eq 'Z' ? $ts_escaped : $1/ge;
$config{timestamp_str} = $render_str;
}
redraw_trackbars() unless $old_irssi;
}
Irssi::settings_add_str('trackbar', 'trackbar_string', is_utf8() ? "\x{2500}" : '-');
Irssi::settings_add_str('trackbar', 'trackbar_style', '%K');
Irssi::settings_add_str('trackbar', 'trackbar_ignore_windows', '');
Irssi::settings_add_bool('trackbar', 'trackbar_use_status_window', 1);
Irssi::settings_add_bool('trackbar', 'trackbar_print_timestamp', 0);
Irssi::settings_add_bool('trackbar', 'trackbar_require_seen', 0);
update_config();
Irssi::signal_add_last( 'mainwindow resized' => 'redraw_trackbars')
unless $old_irssi;
Irssi::signal_register({'window trackbar added' => [qw/Irssi::UI::Window/]});
Irssi::signal_register({'window trackbar seen' => [qw/Irssi::UI::Window/]});
Irssi::signal_register({'gui page scrolled' => [qw/Irssi::UI::Window/]});
Irssi::signal_add_last('gui page scrolled' => 'trackbar_update_seen');
Irssi::signal_add('setup changed' => 'update_config');
Irssi::signal_add_priority('session save' => 'remove_all_trackbars', Irssi::SIGNAL_PRIORITY_HIGH-1);
Irssi::signal_add('window changed' => 'sig_window_changed');
Irssi::command_bind('trackbar goto' => 'goto_trackbar');
Irssi::command_bind('trackbar keep' => 'cmd_keep_once');
Irssi::command_bind('trackbar mark' => 'cmd_mark');
Irssi::command_bind('trackbar markvisible' => 'cmd_markvisible');
Irssi::command_bind('trackbar markall' => 'cmd_markall');
Irssi::command_bind('trackbar remove' => 'cmd_trackbar_remove_one');
Irssi::command_bind('trackbar removeall' => 'cmd_remove_all_trackbars');
Irssi::command_bind('trackbar redraw' => 'redraw_trackbars');
Irssi::command_bind('trackbar' => 'trackbar_runsub');
Irssi::command_bind('mark' => 'cmd_mark');
Irssi::command_bind_last('help' => 'cmd_help');
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_loaded', $IRSSI{name}, $VERSION, $IRSSI{authors});
# workaround for issue #271
{ package Irssi::Nick }

View File

@ -15,12 +15,6 @@ call plug#begin('~/.vim/plugged')
" Utility " Utility
"########### "###########
Plug '~/.fzf' Plug '~/.fzf'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "{{ "{{{" }}
let NERDTreeShowHidden=0
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
"{{ "}}}" }}
Plug 'preservim/tagbar', { 'on': 'TagbarToggle' }
Plug 'lifepillar/vim-mucomplete' "{{ "{{{" }} Plug 'lifepillar/vim-mucomplete' "{{ "{{{" }}
let g:mucomplete#chains = { let g:mucomplete#chains = {
\ 'default': ['c-p', 'omni'], \ 'default': ['c-p', 'omni'],
@ -52,10 +46,6 @@ nnoremap <leader>t :BTags<cr>
nnoremap <leader>T :Tags<cr> nnoremap <leader>T :Tags<cr>
nnoremap <leader>h :Helptags<cr> nnoremap <leader>h :Helptags<cr>
"{{ "}}}" }} "{{ "}}}" }}
Plug 'junegunn/vim-easy-align' "{{ "{{{" }}
xmap gl <Plug>(EasyAlign)
nmap gl <Plug>(EasyAlign)
"{{ "}}}" }}
Plug 'easymotion/vim-easymotion' "{{ "{{{" }} Plug 'easymotion/vim-easymotion' "{{ "{{{" }}
let g:EasyMotion_do_mapping = 0 let g:EasyMotion_do_mapping = 0
let g:EasyMotion_smartcase = 1 let g:EasyMotion_smartcase = 1
@ -66,222 +56,16 @@ nmap <Leader>w <Plug>(easymotion-overwin-w)
map <Leader>j <Plug>(easymotion-j) map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k) map <Leader>k <Plug>(easymotion-k)
"{{ "}}}" }} "{{ "}}}" }}
Plug 'konfekt/fastfold' "{{ "{{{" }}
nmap zuz <Plug>(FastFoldUpdate)
let g:fastfold_savehook = 1
let g:tex_fold_enabled = 1
let g:vimsyn_folding = 'af'
let g:javaScript_fold = 1
let g:perl_fold = 0
let g:php_folding = 0
" {{ "}}}" }}
Plug 'tpope/vim-unimpaired'
Plug 'mhinz/vim-grepper' "{{ "{{{" }}
nnoremap <leader>g :Grepper -tool rg<cr>
nnoremap <leader>G :Grepper -tool ag<cr>
nmap gs <plug>(GrepperOperator)
xmap gs <plug>(GrepperOperator)
let g:grepper = {}
let g:grepper.tools = ['rg', 'ag', 'git', 'ack']
let g:grepper.jump = 1
let g:grepper.next_tool = '<leader>g'
let g:grepper.simple_prompt = 1
let g:grepper.quickfix = 0
"{{ "}}}" }}
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-eunuch'
Plug 'vasconcelloslf/vim-interestingwords' "{{ "{{{" }}
" nnoremap <silent> <leader>k :call InterestingWords('n')<cr>
" nnoremap <silent> <leader>K :call UncolorAllWords()<cr>
" nnoremap <silent> n :call WordNavigation('forward')<cr>
" nnoremap <silent> N :call WordNavigation('backward')<cr>
"{{ "}}}" }}
"#############################
" Generic Programming Support
"#############################
Plug 'honza/vim-snippets'
Plug 'jiangmiao/auto-pairs' "{{ "{{{" }}
let g:AutoPairsShortcutFastWrap='<C-e>'
let g:AutoPairsMapSpace = 0
imap <silent> <expr> <space> pumvisible()
\ ? "<space>"
\ : "<c-r>=AutoPairsSpace()<cr>"
let g:AutoPairsMapCR = 0
let g:AutoPairsMapSpace = 0
imap <silent> <expr> <space> pumvisible()
\ ? "<space>"
\ : "<c-r>=AutoPairsSpace()<cr>"
inoremap <silent> <expr> <plug>UltiExpand
\ mucomplete#ultisnips#expand_snippet("\<cr>")
imap <plug>MyCR <plug>UltiExpand<plug>AutoPairsReturn
imap <cr> <plug>MyCR
"{{ "}}}" }}
Plug 'ntpeters/vim-better-whitespace' "{{ "{{{" }}
let g:better_whitespace_filetypes_blacklist=['mail', 'diff', 'gitcommit', 'unite', 'qf', 'help']
"{{ "}}}" }}
Plug 'tpope/vim-commentary'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'tobyS/vmustache'
Plug 'dense-analysis/ale' "{{ "{{{" }}
let g:ale_sign_error = '✘'
let g:ale_sign_warning = '⚠'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
let g:ale_lint_on_enter = 0
let g:ale_lint_on_text_changed = 'never'
set omnifunc=ale#completion#OmniFunc
let g:ale_linter_aliases = {'svelte': ['css', 'javascript']}
let g:ale_linters = {
\ 'javascript': ['standard'],
\ 'svelte': ['stylelint', 'eslint'],
\ 'go': ['go build', 'gometalinter']
\ }
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier', 'eslint'],
\ 'svelte': ['eslint', 'prettier', 'prettier_standard'],
\ 'go': ['goimports']
\ }
let g:gometalinter_fast = ''
\ . ' --enable=vet'
\ . ' --enable=errcheck'
\ . ' --enable=ineffassign'
\ . ' --enable=goimports'
\ . ' --enable=misspell'
\ . ' --enable=lll --line-length=120'
let g:ale_go_gometalinter_options = '--disable-all --tests' . g:gometalinter_fast . ' --enable=golint'
"{{ "}}}" }}
"#####################
" Markdown / Writing
"#####################
Plug 'dbmrq/vim-ditto' "{{ "{{{" }}
" au FileType markdown,text,tex DittoOn
nmap <leader>di <Plug>ToggleDitto " Turn Ditto on and off
nmap =d <Plug>DittoNext " Jump to the next word
nmap -d <Plug>DittoPrev " Jump to the previous word
nmap +d <Plug>DittoGood " Ignore the word under the cursor
nmap _d <Plug>DittoBad " Stop ignoring the word under the cursor
nmap ]d <Plug>DittoMore " Show the next matches
nmap [d <Plug>DittoLess " Show the previous matches
"{{ "}}}" }}
Plug 'kana/vim-textobj-user'
Plug 'reedes/vim-textobj-quote'
Plug 'reedes/vim-textobj-sentence'
Plug 'reedes/vim-wordy' "{{ "{{{" }}
" let g:wordy_spell_dir = '~/.vim/spell/wordy'
"{{ "}}}" }}
Plug 'reedes/vim-lexical' "{{ "{{{" }} Plug 'reedes/vim-lexical' "{{ "{{{" }}
let g:lexical#thesaurus = ['~/.vim/thesaurus/english.txt',] let g:lexical#thesaurus = ['~/.vim/thesaurus/english.txt',]
let g:lexical#spellfile = ['~/.vim/spell/en.utf-8.add',] let g:lexical#spellfile = ['~/.vim/spell/en.utf-8.add',]
let g:lexical#thesaurus_key = '<leader>t' let g:lexical#thesaurus_key = '<leader>t'
let g:lexical#dictionary_key = '<leader>k' let g:lexical#dictionary_key = '<leader>k'
"{{ "}}}" }} "{{ "}}}" }}
Plug 'reedes/vim-litecorrect'
Plug 'reedes/vim-pencil' "{{ "{{{" }} Plug 'reedes/vim-pencil' "{{ "{{{" }}
let g:pencil#map#suspend_af = 'K' let g:pencil#map#suspend_af = 'K'
"{{ "}}}" }} "{{ "}}}" }}
Plug 'tpope/vim-abolish'
Plug 'plasticboy/vim-markdown' " {{ "{{{" }}
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_new_list_item_indent = 0
let g:vim_markdown_auto_insert_bullets = 1
let g:vim_markdown_frontmatter = 1
let g:vim_markdown_no_extensions_in_markdown = 0
let g:vim_markdown_follow_anchor = 1
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_autowrite = 1
set conceallevel=0
autocmd FileType markdown setlocal spell
autocmd FileType markdown setlocal linebreak " wrap on words, not characters
augroup my_spelling_colors
" Underline, don't do intrusive red things.
autocmd!
" autocmd ColorScheme * hi clear SpellBad
autocmd ColorScheme * hi SpellBad cterm=underline ctermfg=NONE ctermbg=NONE term=Reverse
autocmd ColorScheme * hi SpellCap cterm=underline ctermfg=NONE ctermbg=NONE term=Reverse
autocmd ColorScheme * hi SpellLocal cterm=underline ctermfg=NONE ctermbg=NONE term=Reverse
autocmd ColorScheme * hi SpellRare cterm=underline ctermfg=NONE ctermbg=NONE term=Reverse
augroup END
set spell spelllang=en_us
" {{ "}}}" }}
Plug 'lervag/vimtex' "{{ "{{{" }}
let g:tex_flavor = 'latex'
"{{ "}}}" }}
"#####################
" Productivity
"#####################
Plug 'fcpg/vim-waikiki' "{{ "{{{" }}
let g:waikiki_roots = ['~/doc/wiki/']
let g:waikiki_default_maps = 1
nn <Leader>ww :e ~/doc/wiki/index.md<cr>
"{{ "}}}" }}
Plug 'alok/notational-fzf-vim' "{{ "{{{" }}
let g:nv_search_paths = ['~/doc/zettelkasten', '~/doc/wiki']
"{{ "}}}" }}
"#####################
" Git Support
"#####################
Plug 'tpope/vim-fugitive' "{{ "{{{" }}
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gr :Gremove<CR>
nnoremap <Leader>gl :Glog<CR>
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gm :Gmove
nnoremap <Leader>gp :Ggrep
nnoremap <Leader>gR :Gread<CR>
nnoremap <Leader>gg :Git
nnoremap <Leader>gd :Gdiff<CR>
"{{ "}}}" }}
Plug 'junegunn/gv.vim'
Plug 'mhinz/vim-signify' "{{ "{{{" }}
let g:signify_vcs_list = [ 'git' ]
let g:signify_disable_by_default = 0
let g:signify_realtime = 0
nmap <F10> <Plug>(SignifyToggle)
"{{ "}}}" }}
"#########################
" Web Programming Support
"#########################
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'mxw/vim-jsx'
Plug 'mattn/emmet-vim'
Plug 'othree/html5.vim'
Plug 'lumiliet/vim-twig'
Plug 'evanleck/vim-svelte'
Plug 'jparise/vim-graphql'
Plug 'ap/vim-css-color'
"#########################
" Language support
"#########################
Plug 'vim-perl/vim-perl', { 'for': 'perl' }
Plug 'cespare/vim-toml', { 'for': 'toml' }
Plug 'fatih/vim-go', { 'for': 'go' } " {{ "{{{" }}
let g:go_fmt_command = "goimports"
let g:go_addtags_transform = "camelcase"
autocmd FileType go nmap MM <Plug>(go-build)
autocmd FileType go nmap LL <Plug>(go-run)
autocmd FileType go nmap TT <Plug>(go-test)
autocmd FileType go nmap <Leader>i <Plug>(go-info)
"{{ "}}}" }}
Plug 'rust-lang/rust.vim', { 'for': 'rust' } " {{ "{{{" }}
let g:rustfmt_autosave = 0
let g:rust_recommended_style = 1
" {{ "}}}" }}
"######################### "#########################
" Theme / Interface " Theme / Interface
@ -299,12 +83,10 @@ let g:lightline = {
\ }, \ },
\ } \ }
"{{ "}}}" }} "{{ "}}}" }}
Plug 'morhetz/gruvbox'
Plug 'arcticicestudio/nord-vim' Plug 'arcticicestudio/nord-vim'
call plug#end() call plug#end()
"{{ "}}}" }} "{{ "}}}" }}
" Vim sensible settings {{ "{{{" }}
set nocompatible set nocompatible
set encoding=utf8 set encoding=utf8
set lazyredraw set lazyredraw
@ -401,8 +183,7 @@ set spelllang=en_us
set diffopt+=vertical set diffopt+=vertical
" hi SpellBad gui=underline guifg=red cterm=underline ctermfg=red " hi SpellBad gui=underline guifg=red cterm=underline ctermfg=red
"{{ "}}}" }}
" Theme and Styling {{ "{{{" }}
if has('gui_running') if has('gui_running')
set guifont={{ .guifont }} set guifont={{ .guifont }}
" Scrollbar junk " Scrollbar junk
@ -417,8 +198,6 @@ let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors set termguicolors
colorscheme nord colorscheme nord
set background=dark set background=dark
"{{ "}}}" }}
" Filetype settings {{ "{{{" }}
function! Prose() function! Prose()
call pencil#init({'wrap': 'hard', 'autoformat': 1}) call pencil#init({'wrap': 'hard', 'autoformat': 1})
@ -471,8 +250,7 @@ autocmd FileType help wincmd L
autocmd FileType fugitive wincmd L autocmd FileType fugitive wincmd L
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" autocmd FileType markdown,mkd call Prose() " autocmd FileType markdown,mkd call Prose()
"{{ "}}}" }}
" Mappings {{ "{{{" }}
"allow deletion of previously entered data in insert mode "allow deletion of previously entered data in insert mode
set backspace=indent,eol,start set backspace=indent,eol,start
@ -551,4 +329,3 @@ nmap <Leader>R :retab<CR>
nmap gQ VipJ nmap gQ VipJ
command! -nargs=0 Prose call Prose() command! -nargs=0 Prose call Prose()
"{{ "}}}" }}

View File

@ -8,7 +8,7 @@ account moebius
host mail.moebiusband.org host mail.moebiusband.org
port 587 port 587
user jan user jan
passwordeval "keepassxc-cli show /home/jan/doc/private/Passwords.kdbx server/moebiusband.org -a password" password {{ (keepassxc "moebiusband.org").Password }}
from jan@moebiusband.org from jan@moebiusband.org
account default : moebius account default : moebius