mirror of https://tildegit.org/ben/dotfiles
some weechat nonsense
parent
260153679e
commit
3fae26d1ba
23
bash/.bashrc
23
bash/.bashrc
|
@ -25,7 +25,7 @@ shopt -s checkwinsize
|
||||||
|
|
||||||
# If set, the pattern "**" used in a pathname expansion context will
|
# If set, the pattern "**" used in a pathname expansion context will
|
||||||
# match all files and zero or more directories and subdirectories.
|
# match all files and zero or more directories and subdirectories.
|
||||||
#shopt -s globstar
|
shopt -s globstar
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
|
@ -85,7 +85,7 @@ if [ -x /usr/bin/dircolors ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
# colored GCC warnings and errors
|
||||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
|
||||||
# some more ls aliases
|
# some more ls aliases
|
||||||
alias ll='ls -alF'
|
alias ll='ls -alF'
|
||||||
|
@ -117,7 +117,17 @@ if ! shopt -oq posix; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## Bash Improvements ##
|
||||||
|
# grabbed from:
|
||||||
|
# https://tildegit.org/cdmnky/dotfiles/src/branch/master/bash/.bashrc
|
||||||
|
# bash completion settings
|
||||||
|
bind "set completion-ignore-case on" # ignore case in filenames
|
||||||
|
bind "set completion-map-case on" # treat hyphen the same as underscore
|
||||||
|
bind "set show-all-if-ambiguous on" # show all possibilities on the first tab
|
||||||
|
# automatically add trailing slash when symlinking directories
|
||||||
|
bind "set mark-symlinked-directories on"
|
||||||
|
# cd into directory just by typing it in
|
||||||
|
shopt -s autocd
|
||||||
|
|
||||||
|
|
||||||
# MY STUFF!!
|
# MY STUFF!!
|
||||||
|
@ -125,7 +135,10 @@ fi
|
||||||
|
|
||||||
[ -r /home/ben/.byobu/prompt ] && . /home/ben/.byobu/prompt #byobu-prompt#
|
[ -r /home/ben/.byobu/prompt ] && . /home/ben/.byobu/prompt #byobu-prompt#
|
||||||
|
|
||||||
PATH=.:$PATH
|
user_paths=(~/bin /usr/local/go/bin ~/.yarn/bin $GOPATH/bin ~/.local/bin ~/.cargo/bin /snap/bin ~/.fzf/bin)
|
||||||
|
for path in ${user_paths[*]}; do
|
||||||
|
export PATH=$path:$PATH
|
||||||
|
done
|
||||||
|
|
||||||
export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\u\[$(tput setaf 6)\]@\[$(tput setaf 4)\]\h:\[$(tput setaf 2)\]\w\[$(tput setaf 4)\]\\$ \[$(tput sgr0)\]"
|
export PS1="\[$(tput bold)\]\[$(tput setaf 2)\]\u\[$(tput setaf 6)\]@\[$(tput setaf 4)\]\h:\[$(tput setaf 2)\]\w\[$(tput setaf 4)\]\\$ \[$(tput sgr0)\]"
|
||||||
|
|
||||||
|
@ -140,9 +153,11 @@ g() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -d "$HOME/.nvm" ]; then
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
fi
|
||||||
|
|
||||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
# This file contains fish universal variable definitions.
|
||||||
|
# VERSION: 3.0
|
||||||
|
SETUVAR __fish_init_2_39_8:\x1d
|
||||||
|
SETUVAR __fish_init_2_3_0:\x1d
|
||||||
|
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||||
|
SETUVAR fish_color_cancel:\x2dr
|
||||||
|
SETUVAR fish_color_command:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_comment:red
|
||||||
|
SETUVAR fish_color_cwd:green
|
||||||
|
SETUVAR fish_color_cwd_root:red
|
||||||
|
SETUVAR fish_color_end:brmagenta
|
||||||
|
SETUVAR fish_color_error:brred
|
||||||
|
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_host:normal
|
||||||
|
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||||
|
SETUVAR fish_color_normal:normal
|
||||||
|
SETUVAR fish_color_operator:bryellow
|
||||||
|
SETUVAR fish_color_param:cyan
|
||||||
|
SETUVAR fish_color_quote:yellow
|
||||||
|
SETUVAR fish_color_redirection:brblue
|
||||||
|
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_user:brgreen
|
||||||
|
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||||
|
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||||
|
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||||
|
SETUVAR fish_pager_color_completion:\x1d
|
||||||
|
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||||
|
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||||
|
SETUVAR fisher_dependency_count:bass\x1edone\x1egetopts\x1egitignore\x1ehumanize_duration\x1envm\x1espin
|
|
@ -19,7 +19,7 @@ suggestion_delimiter_word = cyan
|
||||||
commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
|
commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
|
||||||
default_dict = ""
|
default_dict = ""
|
||||||
during_search = off
|
during_search = off
|
||||||
enabled = on
|
enabled = off
|
||||||
real_time = off
|
real_time = off
|
||||||
suggestions = -1
|
suggestions = -1
|
||||||
word_min_length = 2
|
word_min_length = 2
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# weechat -- buffer_autoset.conf
|
||||||
|
#
|
||||||
|
# WARNING: It is NOT recommended to edit this file by hand,
|
||||||
|
# especially if WeeChat is running.
|
||||||
|
#
|
||||||
|
# Use /set or similar command to change settings in WeeChat.
|
||||||
|
#
|
||||||
|
# For more info, see: https://weechat.org/doc/quickstart
|
||||||
|
#
|
||||||
|
|
||||||
|
[look]
|
||||||
|
instant = on
|
||||||
|
timer = 1
|
||||||
|
|
||||||
|
[buffer]
|
||||||
|
irc.tilde.#trivia.hotlist_max_level_nicks_add = "Oz:2,Nerd:2"
|
|
@ -180,7 +180,7 @@ tilde.local_hostname
|
||||||
tilde.usermode
|
tilde.usermode
|
||||||
tilde.command = "/oper root ${sec.data.tildenetoper}; /msg operserv login ${sec.data.pass}"
|
tilde.command = "/oper root ${sec.data.tildenetoper}; /msg operserv login ${sec.data.pass}"
|
||||||
tilde.command_delay
|
tilde.command_delay
|
||||||
tilde.autojoin = "#opers,#secret-sudoers,#meta,#team,#sudoers,#YourTilde,#chaos,#bots,#music,#share,#stevenuniverse,#suwp,#projects,#politics,#dnd,#journal,#shitposting,#quotes,#gopher,#tildeverse,#venting,#idlerpg,#tilderadio,#zaphod,#thunix,#yee,#modded,#minecraft,#minetest,#bbj,#tildelinux,#tildetheater,#slbr,#dadjokes,#sr.ht,#nand.pub,#6502gen,#cosmic,#institute,#.tilde,#irc-court youneedtoknowthepassword,secretsudoteam"
|
tilde.autojoin = "#chaos,#secret-sudoers,#opers,#meta,#team,#sudoers,#YourTilde,#bots,#music,#share,#projects,#politics,#dnd,#journal,#shitposting,#quotes,#gopher,#tildeverse,#idlerpg,#tilderadio,#zaphod,#modded,#minecraft,#minetest,#bbj,#tildelinux,#tildetheater,#slbr,#dadjokes,#cosmic,#institute,#.tilde 57:60,secretsudoteam,youneedtoknowthepassword"
|
||||||
tilde.autorejoin
|
tilde.autorejoin
|
||||||
tilde.autorejoin_delay
|
tilde.autorejoin_delay
|
||||||
tilde.connection_timeout
|
tilde.connection_timeout
|
||||||
|
@ -262,7 +262,7 @@ town.local_hostname
|
||||||
town.usermode
|
town.usermode
|
||||||
town.command
|
town.command
|
||||||
town.command_delay
|
town.command_delay
|
||||||
town.autojoin = "#tildetown,#bots,#dumpsterfire,#projects,#madlibs,#share,#tildemush,#counting,#team,#aaa,#anarkiddies,#movienight,#counting-meta"
|
town.autojoin = "#tildetown,#bots,#dumpsterfire,#projects,#madlibs,#share,#tildemush,#counting,#team,#aaa,#anarkiddies,#movienight,#counting-meta,#heavy"
|
||||||
town.autorejoin
|
town.autorejoin
|
||||||
town.autorejoin_delay
|
town.autorejoin_delay
|
||||||
town.connection_timeout
|
town.connection_timeout
|
||||||
|
@ -344,7 +344,7 @@ sdf.local_hostname
|
||||||
sdf.usermode
|
sdf.usermode
|
||||||
sdf.command
|
sdf.command
|
||||||
sdf.command_delay
|
sdf.command_delay
|
||||||
sdf.autojoin = "#helpdesk,#anonradio,#gopher,#sdf"
|
sdf.autojoin = "#sdf,#gopher,#anonradio,#helpdesk"
|
||||||
sdf.autorejoin
|
sdf.autorejoin
|
||||||
sdf.autorejoin_delay
|
sdf.autorejoin_delay
|
||||||
sdf.connection_timeout
|
sdf.connection_timeout
|
||||||
|
@ -467,7 +467,7 @@ freenode.local_hostname
|
||||||
freenode.usermode
|
freenode.usermode
|
||||||
freenode.command
|
freenode.command
|
||||||
freenode.command_delay
|
freenode.command_delay
|
||||||
freenode.autojoin = "#weechat,##oodnet,#alacritty,#disroot,#fediverse,#irc.net,#lobsters,#lobsters-boil,#lxcontainers,#thelounge,#gitea,#mastodon,#pleroma,#pleroma-offtopic,#pixelfed,#pixelfed-offtopic,#oragono,#weechat-android,#git,#thunix,#nginx,#devuan,#tilde.team,#sr.ht,#cmpwn,#tildeverse,#opennic 6:10"
|
freenode.autojoin = "#freenode,#weechat,##oodnet,#alacritty,#disroot,#fediverse,#irc.net,#lobsters,#lobsters-boil,#lxcontainers,#thelounge,#gitea,#mastodon,#pleroma,#pleroma-offtopic,#pixelfed,#pixelfed-offtopic,#oragono,#weechat-android,#git,#thunix,#nginx,#devuan,#tilde.team,#sr.ht,#cmpwn,#tildeverse,#opennic #freenode-overflow,6:10"
|
||||||
freenode.autorejoin
|
freenode.autorejoin
|
||||||
freenode.autorejoin_delay
|
freenode.autorejoin_delay
|
||||||
freenode.connection_timeout
|
freenode.connection_timeout
|
||||||
|
@ -644,3 +644,44 @@ inspircd.msg_part
|
||||||
inspircd.msg_quit
|
inspircd.msg_quit
|
||||||
inspircd.notify
|
inspircd.notify
|
||||||
inspircd.split_msg_max_length
|
inspircd.split_msg_max_length
|
||||||
|
gitter.addresses = "irc.gitter.im"
|
||||||
|
gitter.proxy
|
||||||
|
gitter.ipv6
|
||||||
|
gitter.ssl = on
|
||||||
|
gitter.ssl_cert
|
||||||
|
gitter.ssl_priorities
|
||||||
|
gitter.ssl_dhkey_size
|
||||||
|
gitter.ssl_fingerprint
|
||||||
|
gitter.ssl_verify
|
||||||
|
gitter.password = "${sec.data.gitter_token}"
|
||||||
|
gitter.capabilities
|
||||||
|
gitter.sasl_mechanism
|
||||||
|
gitter.sasl_username
|
||||||
|
gitter.sasl_password
|
||||||
|
gitter.sasl_key
|
||||||
|
gitter.sasl_timeout
|
||||||
|
gitter.sasl_fail
|
||||||
|
gitter.autoconnect
|
||||||
|
gitter.autoreconnect
|
||||||
|
gitter.autoreconnect_delay
|
||||||
|
gitter.nicks = "benharri"
|
||||||
|
gitter.nicks_alternate
|
||||||
|
gitter.username
|
||||||
|
gitter.realname
|
||||||
|
gitter.local_hostname
|
||||||
|
gitter.usermode
|
||||||
|
gitter.command
|
||||||
|
gitter.command_delay
|
||||||
|
gitter.autojoin
|
||||||
|
gitter.autorejoin
|
||||||
|
gitter.autorejoin_delay
|
||||||
|
gitter.connection_timeout
|
||||||
|
gitter.anti_flood_prio_high
|
||||||
|
gitter.anti_flood_prio_low
|
||||||
|
gitter.away_check
|
||||||
|
gitter.away_check_max_nicks
|
||||||
|
gitter.msg_kick
|
||||||
|
gitter.msg_part
|
||||||
|
gitter.msg_quit
|
||||||
|
gitter.notify
|
||||||
|
gitter.split_msg_max_length
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# weechat -- lua.conf
|
||||||
|
#
|
||||||
|
# WARNING: It is NOT recommended to edit this file by hand,
|
||||||
|
# especially if WeeChat is running.
|
||||||
|
#
|
||||||
|
# Use /set or similar command to change settings in WeeChat.
|
||||||
|
#
|
||||||
|
# For more info, see: https://weechat.org/doc/quickstart
|
||||||
|
#
|
||||||
|
|
||||||
|
[look]
|
||||||
|
check_license = off
|
||||||
|
eval_keep_context = on
|
|
@ -0,0 +1 @@
|
||||||
|
/home/ben/.weechat/lua/matrix.lua
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,19 @@
|
||||||
fifo.fifo = "on"
|
fifo.fifo = "on"
|
||||||
guile.check_license = "off"
|
guile.check_license = "off"
|
||||||
lua.check_license = "off"
|
lua.check_license = "off"
|
||||||
|
lua.matrix.autojoin_on_invite = "on"
|
||||||
|
lua.matrix.backlog_lines = "120"
|
||||||
|
lua.matrix.debug = "off"
|
||||||
|
lua.matrix.encrypted_message_color = "lightgreen"
|
||||||
|
lua.matrix.homeserver_url = "https://l4p1n.ch/"
|
||||||
|
lua.matrix.local_echo = "on"
|
||||||
|
lua.matrix.nick_style = "nick"
|
||||||
|
lua.matrix.password = "${sec.data.matrixpw}"
|
||||||
|
lua.matrix.presence_filter = "off"
|
||||||
|
lua.matrix.read_receipts = "on"
|
||||||
|
lua.matrix.timeout = "5"
|
||||||
|
lua.matrix.typing_notices = "on"
|
||||||
|
lua.matrix.user = "ben"
|
||||||
perl.check_license = "off"
|
perl.check_license = "off"
|
||||||
perl.colorize_lines.blacklist_buffers = ""
|
perl.colorize_lines.blacklist_buffers = ""
|
||||||
perl.colorize_lines.buffers = "all"
|
perl.colorize_lines.buffers = "all"
|
||||||
|
@ -90,6 +103,19 @@ ruby.check_license = "off"
|
||||||
tcl.check_license = "off"
|
tcl.check_license = "off"
|
||||||
|
|
||||||
[desc]
|
[desc]
|
||||||
|
lua.matrix.autojoin_on_invite = "Automatically join rooms you are invited to (default: "on")"
|
||||||
|
lua.matrix.backlog_lines = "Number of lines to fetch from backlog upon connecting (default: "120")"
|
||||||
|
lua.matrix.debug = "Print a lot of extra information to help with finding bugs and other problems. (default: "off")"
|
||||||
|
lua.matrix.encrypted_message_color = "Print encrypted mesages with this color (default: "lightgreen")"
|
||||||
|
lua.matrix.homeserver_url = "Full URL including port to your homeserver (including trailing slash) or use default matrix.org (default: "https://matrix.org/")"
|
||||||
|
lua.matrix.local_echo = "Print lines locally instead of waiting for return from server (default: "on")"
|
||||||
|
lua.matrix.nick_style = "Show nicknames or user IDs in chat ('nick' or 'uid') (default: "nick")"
|
||||||
|
lua.matrix.password = "Your homeserver password (default: "")"
|
||||||
|
lua.matrix.presence_filter = "Filter presence messages and ephemeral events (for performance) (default: "off")"
|
||||||
|
lua.matrix.read_receipts = "Send read receipts. Note that not sending them will prevent a room to be marked as read in Riot clients. (default: "on")"
|
||||||
|
lua.matrix.timeout = "Time in seconds until a connection is assumed to be timed out (default: "5")"
|
||||||
|
lua.matrix.typing_notices = "Send typing notices when you type (default: "on")"
|
||||||
|
lua.matrix.user = "Your homeserver username (default: "")"
|
||||||
perl.colorize_lines.blacklist_buffers = "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)"
|
perl.colorize_lines.blacklist_buffers = "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)"
|
||||||
perl.colorize_lines.buffers = "Buffer type affected by the script (all/channel/query, default: all)"
|
perl.colorize_lines.buffers = "Buffer type affected by the script (all/channel/query, default: all)"
|
||||||
perl.colorize_lines.highlight = "Apply highlight color to the highlighted lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'"
|
perl.colorize_lines.highlight = "Apply highlight color to the highlighted lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'"
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
# (this script requires WeeChat 0.3.0 or newer)
|
# (this script requires WeeChat 0.3.0 or newer)
|
||||||
#
|
#
|
||||||
# History:
|
# History:
|
||||||
|
# 2018-10-03, Pol Van Aubel <dev@polvanaubel.com>
|
||||||
|
# version 0.7: Python3 compatibility. Considerations:
|
||||||
|
# - Settings during registration are iterated over only once, so
|
||||||
|
# code should be succinct rather than efficient on both Py2/3.
|
||||||
|
# - The autojoin_keys zip is turned into a dict, so wouldn't
|
||||||
|
# make sense to first turn into a list as futurize suggests.
|
||||||
# 2015-10-11, Simmo Saan <simmo.saan@gmail.com>
|
# 2015-10-11, Simmo Saan <simmo.saan@gmail.com>
|
||||||
# version 0.6: allow joining channels with keys in autojoin
|
# version 0.6: allow joining channels with keys in autojoin
|
||||||
# 2013-12-21, Sebastien Helleu <flashcode@flashtux.org>
|
# 2013-12-21, Sebastien Helleu <flashcode@flashtux.org>
|
||||||
|
@ -38,7 +44,7 @@ import re
|
||||||
|
|
||||||
SCRIPT_NAME = "autojoin_on_invite"
|
SCRIPT_NAME = "autojoin_on_invite"
|
||||||
SCRIPT_AUTHOR = "xt <xt@bash.no>"
|
SCRIPT_AUTHOR = "xt <xt@bash.no>"
|
||||||
SCRIPT_VERSION = "0.6"
|
SCRIPT_VERSION = "0.7"
|
||||||
SCRIPT_LICENSE = "GPL3"
|
SCRIPT_LICENSE = "GPL3"
|
||||||
SCRIPT_DESC = "Auto joins channels when invited"
|
SCRIPT_DESC = "Auto joins channels when invited"
|
||||||
|
|
||||||
|
@ -56,7 +62,7 @@ settings = {
|
||||||
|
|
||||||
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
|
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
|
||||||
SCRIPT_DESC, "", ""):
|
SCRIPT_DESC, "", ""):
|
||||||
for option, default_value in settings.iteritems():
|
for option, default_value in settings.items():
|
||||||
if not w.config_is_set_plugin(option):
|
if not w.config_is_set_plugin(option):
|
||||||
w.config_set_plugin(option, default_value)
|
w.config_set_plugin(option, default_value)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../buffer_autoset.py
|
|
@ -0,0 +1,350 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010-2017 Sébastien Helleu <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# 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 3 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Auto-set buffer properties when a buffer is opened.
|
||||||
|
# (this script requires WeeChat 1.0 or newer)
|
||||||
|
#
|
||||||
|
# History:
|
||||||
|
#
|
||||||
|
# 2018-04-14, Kim B. Heino:
|
||||||
|
# version 1.1: on startup apply settings to already opened buffers
|
||||||
|
# 2017-06-21, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 1.0: rename command /autosetbuffer to /buffer_autoset
|
||||||
|
# 2015-09-28, Simmo Saan <simmo.saan@gmail.com>:
|
||||||
|
# version 0.9: instantly apply properties
|
||||||
|
# 2015-07-12, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.8: add option buffer_autoset.look.timer to add a small timer
|
||||||
|
# before setting buffer properties
|
||||||
|
# 2015-04-05, Nils Görs <freenode@#weechat>:
|
||||||
|
# version 0.7: increase priority of hook_signal('buffer_opened')
|
||||||
|
# 2012-12-09, Nils Görs <freenode@#weechat>:
|
||||||
|
# version 0.6: add support of core buffer
|
||||||
|
# 2012-03-09, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.5: fix reload of config file
|
||||||
|
# 2012-01-03, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.4: make script compatible with Python 3.x
|
||||||
|
# 2010-12-02, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.3: "no_highlight_nicks" replaced by "hotlist_max_level_nicks"
|
||||||
|
# 2010-10-11, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.2: add example in /help autosetbuffer with new buffer
|
||||||
|
# property "no_highlight_nicks"
|
||||||
|
# 2010-04-19, Sébastien Helleu <flashcode@flashtux.org>:
|
||||||
|
# version 0.1: initial release
|
||||||
|
#
|
||||||
|
|
||||||
|
SCRIPT_NAME = "buffer_autoset"
|
||||||
|
SCRIPT_AUTHOR = "Sébastien Helleu <flashcode@flashtux.org>"
|
||||||
|
SCRIPT_VERSION = "1.1"
|
||||||
|
SCRIPT_LICENSE = "GPL3"
|
||||||
|
SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened"
|
||||||
|
|
||||||
|
SCRIPT_COMMAND = SCRIPT_NAME
|
||||||
|
|
||||||
|
import_ok = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
import weechat
|
||||||
|
except ImportError:
|
||||||
|
print("This script must be run under WeeChat.")
|
||||||
|
print("Get WeeChat now at: http://www.weechat.org/")
|
||||||
|
import_ok = False
|
||||||
|
|
||||||
|
CONFIG_FILE_NAME = "buffer_autoset"
|
||||||
|
|
||||||
|
# config file / options
|
||||||
|
bas_config_file = ""
|
||||||
|
bas_options = {}
|
||||||
|
|
||||||
|
|
||||||
|
# =================================[ config ]=================================
|
||||||
|
|
||||||
|
def bas_config_init():
|
||||||
|
"""
|
||||||
|
Initialization of configuration file.
|
||||||
|
Sections: buffer.
|
||||||
|
"""
|
||||||
|
global bas_config_file, bas_options
|
||||||
|
bas_config_file = weechat.config_new(CONFIG_FILE_NAME,
|
||||||
|
"bas_config_reload_cb", "")
|
||||||
|
if bas_config_file == "":
|
||||||
|
return
|
||||||
|
|
||||||
|
# section "look"
|
||||||
|
section_look = weechat.config_new_section(
|
||||||
|
bas_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
|
||||||
|
if not section_look:
|
||||||
|
weechat.config_free(bas_config_file)
|
||||||
|
return
|
||||||
|
|
||||||
|
# options in section "look"
|
||||||
|
bas_options["look_timer"] = weechat.config_new_option(
|
||||||
|
bas_config_file, section_look, "timer", "integer",
|
||||||
|
"Timer used to delay the set of properties (in milliseconds, "
|
||||||
|
"0 = don't use a timer)",
|
||||||
|
"", 0, 2147483647, "1", "1", 0, "", "", "", "", "", "")
|
||||||
|
|
||||||
|
bas_options["look_instant"] = weechat.config_new_option(
|
||||||
|
bas_config_file, section_look, "instant", "boolean",
|
||||||
|
"Instantly apply properties to buffers affected",
|
||||||
|
"", 0, 0, "on", "on", 0, "", "", "", "", "", "")
|
||||||
|
|
||||||
|
# section "buffer"
|
||||||
|
section_buffer = weechat.config_new_section(
|
||||||
|
bas_config_file, "buffer", 1, 1, "", "", "", "", "", "",
|
||||||
|
"bas_config_buffer_create_option_cb", "", "", "")
|
||||||
|
if not section_buffer:
|
||||||
|
weechat.config_free(bas_config_file)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def bas_config_buffer_create_option_cb(data, config_file, section, option_name,
|
||||||
|
value):
|
||||||
|
option = weechat.config_search_option(config_file, section, option_name)
|
||||||
|
if option:
|
||||||
|
return weechat.config_option_set(option, value, 1)
|
||||||
|
else:
|
||||||
|
option = weechat.config_new_option(config_file, section, option_name,
|
||||||
|
"string", "", "", 0, 0, "",
|
||||||
|
value, 0, "", "", "", "", "", "")
|
||||||
|
if not option:
|
||||||
|
return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR
|
||||||
|
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||||
|
|
||||||
|
|
||||||
|
def bas_config_reload_cb(data, config_file):
|
||||||
|
"""Reload configuration file."""
|
||||||
|
return weechat.config_reload(config_file)
|
||||||
|
|
||||||
|
|
||||||
|
def bas_config_read():
|
||||||
|
"""Read configuration file."""
|
||||||
|
global bas_config_file
|
||||||
|
return weechat.config_read(bas_config_file)
|
||||||
|
|
||||||
|
|
||||||
|
def bas_config_write():
|
||||||
|
"""Write configuration file."""
|
||||||
|
global bas_config_file
|
||||||
|
return weechat.config_write(bas_config_file)
|
||||||
|
|
||||||
|
|
||||||
|
# ================================[ command ]=================================
|
||||||
|
|
||||||
|
def bas_cmd(data, buffer, args):
|
||||||
|
"""Callback for /buffer_autoset command."""
|
||||||
|
args = args.strip()
|
||||||
|
if args == "":
|
||||||
|
weechat.command("", "/set %s.buffer.*" % CONFIG_FILE_NAME)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
argv = args.split(None, 3)
|
||||||
|
if len(argv) > 0:
|
||||||
|
if argv[0] == "add":
|
||||||
|
if len(argv) < 4:
|
||||||
|
weechat.command("", "/help %s" % SCRIPT_COMMAND)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
weechat.command("", "/set %s.buffer.%s.%s \"%s\""
|
||||||
|
% (CONFIG_FILE_NAME, argv[1], argv[2], argv[3]))
|
||||||
|
elif argv[0] == "del":
|
||||||
|
if len(argv) < 2:
|
||||||
|
weechat.command("", "/help %s" % SCRIPT_COMMAND)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
weechat.command("", "/unset %s.buffer.%s"
|
||||||
|
% (CONFIG_FILE_NAME, argv[1]))
|
||||||
|
else:
|
||||||
|
weechat.command("", "/help %s" % SCRIPT_COMMAND)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
def bas_completion_current_buffer_cb(data, completion_item, buffer,
|
||||||
|
completion):
|
||||||
|
"""
|
||||||
|
Complete with current buffer name (plugin.name),
|
||||||
|
for command '/buffer_autoset'.
|
||||||
|
"""
|
||||||
|
name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"),
|
||||||
|
weechat.buffer_get_string(buffer, "name"))
|
||||||
|
weechat.hook_completion_list_add(completion, name,
|
||||||
|
0, weechat.WEECHAT_LIST_POS_BEGINNING)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
def bas_completion_options_cb(data, completion_item, buffer, completion):
|
||||||
|
"""Complete with config options, for command '/buffer_autoset'."""
|
||||||
|
options = weechat.infolist_get("option", "",
|
||||||
|
"%s.buffer.*" % CONFIG_FILE_NAME)
|
||||||
|
if options:
|
||||||
|
while weechat.infolist_next(options):
|
||||||
|
weechat.hook_completion_list_add(
|
||||||
|
completion,
|
||||||
|
weechat.infolist_string(options, "option_name"),
|
||||||
|
0, weechat.WEECHAT_LIST_POS_SORT)
|
||||||
|
weechat.infolist_free(options)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
# ==========================[ timer/signal/option ]===========================
|
||||||
|
|
||||||
|
def bas_apply_options_for_buffer(buffer):
|
||||||
|
full_name = weechat.buffer_get_string(buffer, "full_name")
|
||||||
|
options = weechat.infolist_get("option", "",
|
||||||
|
"%s.buffer.*" % CONFIG_FILE_NAME)
|
||||||
|
if not options:
|
||||||
|
return
|
||||||
|
|
||||||
|
while weechat.infolist_next(options):
|
||||||
|
option = weechat.infolist_string(options, "option_name")
|
||||||
|
value = weechat.infolist_string(options, "value")
|
||||||
|
if option:
|
||||||
|
pos = option.rfind(".")
|
||||||
|
if pos > 0:
|
||||||
|
buffer_mask = option[0:pos]
|
||||||
|
property = option[pos+1:]
|
||||||
|
if buffer_mask and property:
|
||||||
|
if weechat.string_match(full_name, buffer_mask, 1):
|
||||||
|
weechat.buffer_set(buffer, property, value)
|
||||||
|
|
||||||
|
weechat.infolist_free(options)
|
||||||
|
|
||||||
|
|
||||||
|
def bas_timer_buffer_opened_cb(data, remaining_calls):
|
||||||
|
full_name = data
|
||||||
|
buffer = weechat.buffer_search("==", full_name)
|
||||||
|
if not buffer:
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
bas_apply_options_for_buffer(buffer)
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
def bas_signal_buffer_opened_cb(data, signal, signal_data):
|
||||||
|
global bas_options
|
||||||
|
buffer = signal_data
|
||||||
|
timer = weechat.config_integer(bas_options["look_timer"])
|
||||||
|
if timer == 0:
|
||||||
|
bas_apply_options_for_buffer(buffer)
|
||||||
|
else:
|
||||||
|
weechat.hook_timer(timer, 0, 1,
|
||||||
|
"bas_timer_buffer_opened_cb",
|
||||||
|
weechat.buffer_get_string(buffer, "full_name"))
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
def bas_config_option_cb(data, option, value):
|
||||||
|
if not weechat.config_boolean(bas_options["look_instant"]):
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
if not weechat.config_get(option): # option was deleted
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
option = option[len("%s.buffer." % CONFIG_FILE_NAME):]
|
||||||
|
|
||||||
|
pos = option.rfind(".")
|
||||||
|
if pos > 0:
|
||||||
|
buffer_mask = option[0:pos]
|
||||||
|
property = option[pos+1:]
|
||||||
|
if buffer_mask and property:
|
||||||
|
buffers = weechat.infolist_get("buffer", "", buffer_mask)
|
||||||
|
|
||||||
|
if not buffers:
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
while weechat.infolist_next(buffers):
|
||||||
|
buffer = weechat.infolist_pointer(buffers, "pointer")
|
||||||
|
weechat.buffer_set(buffer, property, value)
|
||||||
|
|
||||||
|
weechat.infolist_free(buffers)
|
||||||
|
|
||||||
|
return weechat.WEECHAT_RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
# ==================================[ main ]==================================
|
||||||
|
|
||||||
|
if __name__ == "__main__" and import_ok:
|
||||||
|
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
|
||||||
|
SCRIPT_LICENSE, SCRIPT_DESC, "bas_unload_script", ""):
|
||||||
|
version = weechat.info_get("version_number", "") or 0
|
||||||
|
if int(version) < 0x01000000:
|
||||||
|
weechat.prnt("", "%s%s: WeeChat 1.0 is required for this script."
|
||||||
|
% (weechat.prefix("error"), SCRIPT_NAME))
|
||||||
|
else:
|
||||||
|
bas_config_init()
|
||||||
|
bas_config_read()
|
||||||
|
weechat.hook_command(
|
||||||
|
SCRIPT_COMMAND,
|
||||||
|
"Auto-set buffer properties when a buffer is opened",
|
||||||
|
"[add buffer property value] | [del option]",
|
||||||
|
" add: add a buffer/property/value in configuration file\n"
|
||||||
|
" del: delete an option from configuration file\n"
|
||||||
|
" buffer: name of a buffer (can start or end with \"*\" as "
|
||||||
|
"wildcard)\n"
|
||||||
|
"property: buffer property\n"
|
||||||
|
" value: value for property\n"
|
||||||
|
" option: name of option from configuration file\n\n"
|
||||||
|
"Examples:\n"
|
||||||
|
" disable timestamp on channel #weechat:\n"
|
||||||
|
" /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
|
||||||
|
"time_for_each_line 0\n"
|
||||||
|
" add word \"weechat\" in highlight list on channel "
|
||||||
|
"#savannah:\n"
|
||||||
|
" /" + SCRIPT_COMMAND + " add irc.freenode.#savannah "
|
||||||
|
"highlight_words_add weechat\n"
|
||||||
|
" disable highlights from nick \"mike\" on freenode server, "
|
||||||
|
"channel #weechat (requires WeeChat >= 0.3.4):\n"
|
||||||
|
" /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
|
||||||
|
"hotlist_max_level_nicks_add mike:2\n"
|
||||||
|
" disable hotlist changes for nick \"bot\" on freenode "
|
||||||
|
"server (all channels) (requires WeeChat >= 0.3.4):\n"
|
||||||
|
" /" + SCRIPT_COMMAND + " add irc.freenode.* "
|
||||||
|
"hotlist_max_level_nicks_add bot:-1",
|
||||||
|
"add %(buffers_plugins_names)|"
|
||||||
|
"%(buffer_autoset_current_buffer) "
|
||||||
|
"%(buffer_properties_set)"
|
||||||
|
" || del %(buffer_autoset_options)",
|
||||||
|
"bas_cmd", "")
|
||||||
|
weechat.hook_completion(
|
||||||
|
"buffer_autoset_current_buffer",
|
||||||
|
"current buffer name for buffer_autoset",
|
||||||
|
"bas_completion_current_buffer_cb", "")
|
||||||
|
weechat.hook_completion(
|
||||||
|
"buffer_autoset_options",
|
||||||
|
"list of options for buffer_autoset",
|
||||||
|
"bas_completion_options_cb", "")
|
||||||
|
weechat.hook_signal("9000|buffer_opened",
|
||||||
|
"bas_signal_buffer_opened_cb", "")
|
||||||
|
weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME,
|
||||||
|
"bas_config_option_cb", "")
|
||||||
|
|
||||||
|
# apply settings to all already opened buffers
|
||||||
|
buffers = weechat.infolist_get("buffer", "", "")
|
||||||
|
if buffers:
|
||||||
|
while weechat.infolist_next(buffers):
|
||||||
|
buffer = weechat.infolist_pointer(buffers, "pointer")
|
||||||
|
bas_signal_buffer_opened_cb("", "", buffer)
|
||||||
|
weechat.infolist_free(buffers)
|
||||||
|
|
||||||
|
|
||||||
|
# ==================================[ end ]===================================
|
||||||
|
|
||||||
|
def bas_unload_script():
|
||||||
|
""" Function called when script is unloaded. """
|
||||||
|
global bas_config_file
|
||||||
|
|
||||||
|
if bas_config_file:
|
||||||
|
bas_config_write()
|
||||||
|
return weechat.WEECHAT_RC_OK
|
|
@ -126,7 +126,7 @@ scroll_bottom_after_switch = off
|
||||||
scroll_page_percent = 100
|
scroll_page_percent = 100
|
||||||
search_text_not_found_alert = on
|
search_text_not_found_alert = on
|
||||||
separator_horizontal = "─"
|
separator_horizontal = "─"
|
||||||
separator_vertical = "│"
|
separator_vertical = ""
|
||||||
tab_width = 1
|
tab_width = 1
|
||||||
time_format = "%a, %d %b %Y %T"
|
time_format = "%a, %d %b %Y %T"
|
||||||
window_auto_zoom = off
|
window_auto_zoom = off
|
||||||
|
|
|
@ -28,8 +28,8 @@ text_selected = white
|
||||||
[network]
|
[network]
|
||||||
blocksize = 65536
|
blocksize = 65536
|
||||||
fast_send = on
|
fast_send = on
|
||||||
own_ip = ""
|
own_ip = "172.93.50.135"
|
||||||
port_range = ""
|
port_range = "2010-2015"
|
||||||
send_ack = on
|
send_ack = on
|
||||||
speed_limit = 0
|
speed_limit = 0
|
||||||
timeout = 300
|
timeout = 300
|
||||||
|
|
Loading…
Reference in New Issue