Instalacja Geany, mojego rozszerzenia i schematu kolorów składni
- Janusz Augustyński
- 17 kwi 2020
- 4 minut(y) czytania
Zaktualizowano: 27 cze 2022
Geany
W systemie operacyjnym Gentoo Linux wystarczy się zalogować jako użytkownik root i wydać polecenie:
emerge geany
W innych systemach Linux istnieją podobne polecenia zarządzania pakietami, gdzie wystarczy zamiast "emerge" podać właściwe dla tego systemu polecenie.
Jeśli natomiast Geany nie jest dostępny w twoim systemie, to należy go pobrać, skompilować i zainstalować ze źródeł.
Pobieramy Geany z https://geany.org/download/releases/ Najlepiej wybrać "Source (tar.bz2)". Następnie rozpakowujemy poleceniem:
tar -xf geany-1.36.tar.bz2
lub podobnym. Przechodzimy do katalogu źródeł Geany:
cd geany-1.36
i kompilujemy:
./configure --enable-gtk3 --disable-nls --prefix="$HOME/.local"
make
make install
Jeśli wszystko pójdzie dobrze, to Geany możemy wywołać poleceniem:
$HOME/.local/bin/geany -s --socket-file=/tmp/${USER}/geany-socket-$( xprop -root _NET_CURRENT_DESKTOP | cut -d \ -f 3 )
lub po prostu:
$HOME/.local/bin/geany
Moje rozszerzenie Geany
Pobieramy rozszerzenie z zachowaniem połączenia ze źródłem:
git clone https://github.com/overcq/geany-plugin.git
(Do tego potrzebne było narzędzie Git, które trzeba wcześniej zainstalować podobnie jak Geany.)
Następnie przechodzimy do katalogu źródeł rozszerzenia:
cd geany-plugin
Kompilujemy rozszerzenie do postaci biblioteki dołączanej w czasie wykonywania:
make
Sprawdzamy, gdzie się ono znajduje:
pwd
Kopiujemy wypisaną ścieżkę. Uruchamiamy Geany i otwieramy z menu Edit ➪ okno Preferences i na karcie General ➪ Startup wklejamy ją do pola "Extra plugin path". A następnie zatwierdzamy przyciskiem OK. Zamykamy Geany i uruchamiamy ponownie. Otwieramy menu Tools ➪ okno Plugin Manager i zaptaszkujemy "Geany-ocq utility", jeśli nie jest zaptaszkowane. Teraz możemy korzystać z funkcjonalności mojego rozszerzenia Geany, które omówię w innym wpisie.
Otwieramy menu Edit ➪ okno Preferences, na karcie Keybindings przewiajamy w dół do "Geany-ocq utility" i ustawiamy skróty klawiaturowe dla poleceń — teraz albo później. Zaznaczamy polecenie, klikamy przycisk Change wciskamy na klawiaturze skrót polecenia i potwierdzamy przyciskiem OK. A na końcu zamykamy okno przyciskiem OK. Oto proponowane skróty:


Schemat kolorów składni
Uruchamiamy Geany i otwieramy z menu Tools ➪ Configuration Files ➪ filetypes.common, i zastępujemy zawartość pliku następującym tekstem:
# For complete documentation of this file, please see Geany's main documentation
[styling]
# use foreground;background;bold;italic or named_style,bold,italic
# used for filetype All/None
default=default
# 3rd selection argument is true to override default foreground
# 4th selection argument is true to override default background
selection=selection
# style for a matching brace
brace_good=brace_good
# style for a non-matching brace (a brace without a counterpart)
brace_bad=brace_bad
# the following settings define the colours of the margins on the left side
margin_linenumber=margin_line_number
margin_folding=margin_folding
fold_symbol_highlight=fold_symbol_highlight
# background colour of the current line, only the second and third argument is interpreted
# use the third argument to enable or disable the highlighting of the current line (has to be true/false)
current_line=current_line
# translucency for the current line(first argument) and the selection (second argument)
# values between 0 and 256 are accepted. Note for Windows 95, 98 and ME users:
# keep this value at 256 to disable translucency otherwise Geany might crash
translucency=256;256
# style for a highlighted line (e.g when using Goto line or goto tag)
marker_line=marker_line
# style for a marked search results (when using "Mark" in Search dialogs)
# the second argument sets the background colour for the drawn rectangle
# only the second argument is interpreted
marker_search=marker_search
# style for a marked line (e.g when using the "Toggle Marker" keybinding (Ctrl-M))
marker_mark=marker_mark
# translucency for the line marker(first argument) and the search marker (second argument)
marker_translucency=256;256
# colour of the caret(the blinking cursor), only first and third argument is interpreted
# set the third argument to true to change the caret into a block caret
caret=caret
# width of the caret(the blinking cursor)
# width in pixels, use 0 to make it invisible, maximum width is 3
caret_width=1
# set foreground and background colour of indentation guides
indent_guide=indent_guide
# third argument: if true, use this foreground color. If false, use the default value defined by the filetypes.
# fourth argument: if true, use this background color. If false, use the default value defined by the filetypes.
white_space=white_space
# style of folding icons, valid values are:
# first argument: 1 for boxes, 2 for circles, 3 for arrows, 4 for +/-
# second argument: 1 for straight lines, 2 for curved lines or 0 for none
folding_style=3;1;
# should an horizontal line be drawn at the line where text is folded
# 0 to disable
# 1 to draw the line above folded text
# 2 to draw the line below folded text
folding_horiz_line=2
# first argument: drawing of visual flags to indicate a line is wrapped. This is a bitmask of the
# values: 0 - No visual flags, 1 - Visual flag at end of subline of a wrapped line, 2 - Visual flag
# at begin of subline of a wrapped line, Subline is indented by at least 1 to make room for the flag.
# second argument: whether the visual flags to indicate a line is wrapped are drawn near the border
# or near the text. This is a bitmask of the values: 0 - Visual flags drawn near border,
# 1 - Visual flag at end of subline drawn near text, 2 - Visual flag at begin of subline drawn near text
line_wrap_visuals=3;1;
# first argument: sets the size of indentation of sublines for wrapped lines in terms of
# the width of a space, only used when the second argument is 0
# second argument: wrapped sublines can be indented to the position of their first subline or
# one more indent level, possible values:
# 0 - Wrapped sublines aligned to left of window plus amount set by the first argument
# 1 - Wrapped sublines are aligned to first subline indent (use the same indentation)
# 2 - Wrapped sublines are aligned to first subline indent plus one more level of indentation
line_wrap_indent=2;0;
# first argument: amount of space to be drawn above the line's baseline
# second argument: amount of space to be drawn below the line's baseline
line_height=0;0;
# 3rd argument is true to override default foreground of calltips
# 4th argument is true to override default background of calltips
calltips=call_tips
[settings]
# which characters should be skipped when moving (or included when deleting) to word boundaries
# should always include space and tab (\s\t)
whitespace_chars=\s\t!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~
[named_styles]
# This is the Default "built-in" color scheme
default=0x000000;0xcacaca
#sprawdzić wartości “true” w:
error=0xd3d300;0xaf4b4b
selection=;0xc49c9c;;true
current_line=;0xcecece;false
brace_good=0x5f5f5f
brace_bad=0xdf0000
margin_line_number=0x5f5f5f
margin_folding=0x7a7a7f
fold_symbol_highlight=0xcacaca
indent_guide=0x7a7a7f
caret=0xbf5f00
marker_line=;0xb8b8b8
marker_search=;0xc79c9c
marker_mark=;0xb6b6b6
call_tips=0x000000;0xcecece;true;true
white_space=0x7a7a7f;;true;
comment=0x5f5f5f
comment_doc=0x2b375f
comment_line=comment
comment_line_doc=comment_doc
comment_doc_keyword=comment_doc
comment_doc_keyword_error=comment_doc
number=0x5f0037
number_1=number
number_2=number_1
type=0x005f00
class=type
function=default
parameter=function
keyword=0x00005f
keyword_1=keyword
keyword_2=0x005f00
keyword_3=keyword_1
keyword_4=keyword_1
identifier=default
identifier_1=identifier
identifier_2=identifier_1
identifier_3=identifier_1
identifier_4=identifier_1
string=0x5f3700
string_1=string
string_2=string_1
string_eol=0x000000;0xbfaf8f
character=string_1
backticks=string_2
here_doc=string_2
scalar=string_2
label=0x5f0000
preprocessor=0x002b00
regex=number_1
operator=default
decorator=string_1
other=0x7a7a7f
tag=type
tag_unknown=tag
tag_end=tag
attribute=keyword_1
attribute_unknown=attribute
value=string_1
entity=default
line_added=0x34b034;0xffffff
line_removed=0xff2727;0xffffff
line_changed=0x7f007f;0xffffff
Zapisujemy plik i zamykamy. Teraz kolory składni tekstu programu są zgodne z moimi.
コメント