[Geany-Users] Configuring Geany for Python Code and Documentation - version 2
Tim Wallace
twallace51 at xxxxx
Tue May 7 19:16:47 UTC 2019
My Geany Configuration
References:
'''https://www.geany.org/'''
'''http://go-lang.cat-v.org/text-editors/geany/'''
Problem:
Python code
with too much distracting documentation ...
Documentation
difficult to navigate between sections and references ...
with blocks of code that are not easily executable ...
Solution:
An editor that manages both text and code files:
with code folding based on indentation (Python type)
right click option, to open file pathnames, both relative and
absolute, directly in editor
right click on htttp://web_address, to open address in a given web
browser
syntax highlighting for Python files - *.py
keyword highlighting for document files - *.txt, *.hlp, *.gny
Note:
I selected the *.gny extension to emphasize that a given text file is
best reviewed
with a custom configured Geany, as described here...
I selected the *.hlp extension for the documentation retrieved from
Python source code by:
>>> help(module_name)
Following describes my custom configuration for Geany ....
Done with support from Linux Mint, pylint3, dolphin and chromium-browser.
twallace51 at gmail.com
To configure Geany manually:
Install and open Geany....
Click on MenuBar > Edit > Preferences >
and edit following:
Interface > Message Window >
click [x] Right # tall is easier to read than wide, on a large
screen
Editor > Indentation >
width 2 # my personal preference rather than default 4
type spaces
Files > Saving Files >
[x] strip trailing spaces and tabs # to help comply with pylint3
[x] replace tab with space
Tools > Tool Paths >
set Browser to chromium-browser # or Firefox if
prefer
Tools > Commands >
set Context Action to chromium-browser %s
#Now available:
# click-drag on a valid web address -> selects address
# right clicking on address -> opens a popup menu
# clicking Context Action -> opens address in given web
browser
Also Note:
# right clicking on the pathname of a file -> opens the popup menu
# clicking on Open Selected -> opens the file in
Geany
Keybindings > # Note: many of common keybindings are included by
defualt,
#eg for Run, Find, Find Next, Select All, Cut, Copy, Paste, etc
Editor
Delete current line(s) Alt-D
Format
Increase indent Alt-I # note that the Tab key is
equivalent
Decrease indent Shift-ISO_Left_Tab
Search
Replace Alt-R # easier to reach with one
hand, but most editors use default Ctrl-H
Document
Fold all Alt-C
Unfold all Alt-X
GoTo
Go to line Alt-G
Click on MenuBar > Edit > Plugin Preferences >
FileBrowser
dolphin "%d" # I like the split screen option in dolphin
TreeBrowser
dolphin "%d"
Click on Menu > Build > Set Build Commands >
Replace all defaults with following:
Under Doc commands >
Pylint pylint3 --rcfile=~/mylintrc "%f" # assumes
default pylintrc modified and saved as ~/mylintrc
Under Execute commands >
Python3.7 python3.7 "%f"
Click on Menu > Tools > Plugin Manager >
First, install package "geany-plugins" with Synaptic or sudo apt-get.
Then of the many available plugins, enable the most useful:
SplitWindow
AutoMark
Click on File > New (with template) >
Note:
To see your custom templates in Geany File menu, put your templates in
~/.config/geany/templates/files
To put your custom templates ~above~ the defaults in the template
list,
use an initial underline character in your template`s name, for
example:
_pure_python.py
_PyQt5.py
To enable folding and simple syntax coloring for *.txt, *.hlp and *.gny
files
======================================================================
Easy Option:
======================================================================
Click on Menu > Tools > Configuration Files > filetype_extensions.conf
Look for
Python=*.py;*.pyw;SConstruct;SConscript;wscript;
replace with
Python=*.py;*.pyw;SConstruct;SConscript;wscript;*.txt;*.hlp;*.gny
======================================================================
Better Option: # based on
http://go-lang.cat-v.org/text-editors/geany/
======================================================================
On bash command line:
Copy Geany global config file to local configuration directory - so
any changes are now local:
cp -v /usr/share/geany/filetype_extensions.conf
~/.config/geany
Copy and rename following:
cp -v /usr/share/geany/filedefs/filetypes.python
~/.config/geany/filedefs/filetypes.Txt.conf
Note: Once these files have been copied, they can be updated later
under
Geany > MenuBar > Tools > Configuration Files > ...
Add following to ~/.config/geany/filetype_extensions.conf:
Txt=*.txt;*.hlp;*.gny # between Tcl=... and Txt2tags=...
Edit following in ~/.config/geany/filedefs/filetypes.Txt.conf:
Comment out keywords list, so will not be highlighted
[keywords]
#primary=....
#identifiers=....
.
or replace with your own keywords, eg my favorites:
primary = Note Warning Syntax Example Examples Description Goal
References Usage Instalation Configuration Details Classes
Enable python style folding and highligting
[settings]
extension=txt,hlp,gny
lexer_filetype=Python
Remove any build commands found here:
[build-menu]
FT_00_LB=
FT_00_CM=
FT_00_WD=
FT_02_LB=
FT_02_CM=
FT_02_WD=
EX_00_LB=
EX_00_CM=
EX_00_WD=
--
Tim Wallace twallace51 at gmail.com
Cochabamba, Bolivia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/users/attachments/20190507/b2e81b06/attachment.html>
More information about the Users
mailing list