Skip to content

Commit 3cd796e

Browse files
committed
editors: Add support for xfce mousepad
1 parent f015f32 commit 3cd796e

File tree

2 files changed

+194
-0
lines changed

2 files changed

+194
-0
lines changed

editors/mousepad/install.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env bash
2+
3+
4+
set -Eeuo pipefail
5+
6+
VERSION=1.0
7+
EDITOR=MOUSEPAD
8+
9+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
10+
MOUSEPAD_EXTENSION_DIR="$HOME/.local/share/gtksourceview-4/language-specs/"
11+
LANGFILE=piccodescript.lang
12+
13+
14+
log() {
15+
printf "[INFO] %s\n" "$1"
16+
}
17+
18+
splash() {
19+
log " "
20+
log "▄▖▘ ▌ ▄▖ ▘ ▗ "
21+
log "▙▌▌▛▘▛▘▛▌▛▌█▌▚ ▛▘▛▘▌▛▌▜▘"
22+
log "▌ ▌▙▖▙▖▙▌▙▌▙▖▄▌▙▖▌ ▌▙▌▐▖"
23+
log ""
24+
log " "
25+
log " $VERSION "
26+
log " "
27+
log " ===== "
28+
log " BUILD AND "
29+
log " INSTALLATION SCRIPT "
30+
log " FOR "
31+
log " $EDITOR "
32+
log " ===== "
33+
log " "
34+
log " (c) Hexaredecimal "
35+
log " "
36+
}
37+
38+
checkConfig() {
39+
log "Seaching for $EDITOR config folder"
40+
if [[ -d "$MOUSEPAD_EXTENSION_DIR" ]] then
41+
log "Set $EDITOR config to $MOUSEPAD_EXTENSION_DIR"
42+
else
43+
log "Error: Unable to find Visual Studio Code Path in $HOME!"
44+
XYZ #cause an error
45+
fi
46+
}
47+
48+
checkExension() {
49+
log "Looking for previous versions of this extension"
50+
if [[ -d $MOUSEPAD_EXTENSION_DIR ]]
51+
then
52+
log "Removing old installation"
53+
rm -vrf $MOUSEPAD_EXTENSION_DIR
54+
log "Prepare for new installation"
55+
mkdir -vp $MOUSEPAD_EXTENSION_DIR
56+
else
57+
log "No previous installation found. Preparing folder"
58+
mkdir -vp $MOUSEPAD_EXTENSION_DIR
59+
fi
60+
}
61+
62+
install() {
63+
log "Installation started"
64+
log "Copying files to $MOUSEPAD_EXTENSION_DIR"
65+
cp -vr $SCRIPT_DIR/$LANGFILE $MOUSEPAD_EXTENSION_DIR
66+
log "Installation done"
67+
}
68+
69+
finalMessage() {
70+
log ""
71+
log "Thank you for installing the piccodescript mode for $EDITOR"
72+
}
73+
74+
handle_error() {
75+
log "Something went wrong"
76+
log "Aborting"
77+
}
78+
79+
trap handle_error ERR
80+
81+
82+
main() {
83+
splash
84+
checkConfig
85+
checkExension
86+
install
87+
finalMessage
88+
}
89+
90+
main
91+
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<language id="piccodescript" name="Piccodescript" version="2.0" _section="Script">
3+
<metadata>
4+
<property name="mimetypes">text/x-piccodescript</property>
5+
<property name="globs">*.pics</property>
6+
<property name="line-comment-start">//</property>
7+
<property name="block-comment-start">/*</property>
8+
<property name="block-comment-end">*/</property>
9+
<property name="suggested-suffix">.pics</property>
10+
</metadata>
11+
12+
<styles>
13+
<style id="comment" name="Comment" map-to="def:comment"/>
14+
<style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
15+
<style id="multiline-string" name="Multiline string" map-to="def:string"/>
16+
<style id="string" name="String" map-to="def:string"/>
17+
<style id="keyword" name="Keyword" map-to="def:keyword"/>
18+
<style id="boolean" name="Boolean value" map-to="def:boolean"/>
19+
<style id="floating-point" name="Floating-point number" map-to="def:floating-point"/>
20+
<style id="decimal" name="Decimal number" map-to="def:decimal"/>
21+
<style id="base-n-integer" name="Base-N number" map-to="def:base-n-integer"/>
22+
<style id="type" name="Data Type" map-to="def:type"/>
23+
</styles>
24+
25+
<definitions>
26+
27+
<define-regex id="escaped-character" extended="true">
28+
\\( # leading backslash
29+
[\\\"\'nrbtfs] | # escaped character
30+
[0-7]{1,3} | # latin encoded char
31+
u+[0-9a-fA-F]{4} # unicode char
32+
)
33+
</define-regex>
34+
35+
<context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
36+
<start>"</start>
37+
<end>"</end>
38+
<include>
39+
<context id="escaped-character" style-ref="escaped-character">
40+
<match>\%{escaped-character}</match>
41+
</context>
42+
</include>
43+
</context>
44+
45+
<context id="multiline-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
46+
<start>"""\s*$</start>
47+
<end>"""</end>
48+
<include>
49+
<context style-ref="escaped-character">
50+
<match>\%{escaped-character}</match>
51+
</context>
52+
</include>
53+
</context>
54+
55+
<context id="flow" style-ref="keyword">
56+
<keyword>import</keyword>
57+
<keyword>module</keyword>
58+
<keyword>when</keyword>
59+
<keyword>is</keyword>
60+
<keyword>if</keyword>
61+
<keyword>else</keyword>
62+
<keyword>do</keyword>
63+
<keyword>catch</keyword>
64+
<keyword>use</keyword>
65+
<keyword>let</keyword>
66+
<keyword>in</keyword>
67+
</context>
68+
69+
<context id="boolean" style-ref="boolean">
70+
<keyword>false</keyword>
71+
<keyword>true</keyword>
72+
</context>
73+
74+
<context id="floating-point" style-ref="floating-point">
75+
<match extended="true" case-sensitive="false">
76+
\b(
77+
\d+[fd] |
78+
((\d*\.\d+|\d+\.)(e[-+]?\d+)? |
79+
\d+e[-+]?\d+)[fd]?
80+
)
81+
</match>
82+
</context>
83+
<context id="base-n-integer" style-ref="base-n-integer">
84+
<match case-sensitive="false">\b(0x[\da-f]+|0[0-7]+)l?</match>
85+
</context>
86+
<context id="decimal" style-ref="decimal">
87+
<match case-sensitive="false">\b([1-9]\d*|0)l?</match>
88+
</context>
89+
90+
<context id="piccodescript" class="no-spell-check">
91+
<include>
92+
<context ref="multiline-string"/>
93+
<context ref="string"/>
94+
<context ref="flow"/>
95+
<context ref="boolean"/>
96+
<context ref="floating-point"/>
97+
<context ref="base-n-integer"/>
98+
<context ref="decimal"/>
99+
</include>
100+
</context>
101+
102+
</definitions>
103+
</language>

0 commit comments

Comments
 (0)