Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Geany Configuration
#1
I have used almost all the IDEs for Python, and find most of their screens too cluttered or distracting.
I always come back to Geany, which in default configuration, has been very useful.
However, I found that Geany does not have folding and highlighting for *.doc nor *.txt filetypes,
and that it can be configured to be even better (at least for me Smile ).
I thought others might be interested in my sharing how I configure Geany (see below).
(I know, the following should be an attachment, but I dont have attachment privileges yet ....)

My Geany Configuration           [email protected]
  for managing python3.6 modules and adding syntax folding/highlighting to associated document files,
  with support from Linux Mint, pylint3, dolphin and chromium-browser
  '''References:
  https://www.geany.org/
  http://go-lang.cat-v.org/text-editors/geany/
  '''
Click on MenuBar > Edit > Preferences >
  and edit following:

  Interface > Message Window >
    click [x] Right  # long 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 Contest Action to      chromium-browser %s   # enables right click to open web addresses in code

  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
      Decrease indent           Alt-U
    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

Click on MenuBar > Edit > Plugin Preferences >
  FileBrowser
    dolphin "%d"      # I like the split screen option
  TreeBrowser
    dolphin "%d"

Cick 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
      pep8         pep8 --max-line-length=240 "%f"     # assumes a wide screen monitor
    Under Execute commands >
      Python3.6    python3.6 "%f"                      # rather than 3.7,  since PyQt5 installs in 3.6 directories   

Click on Menu > Tools > Plugin Manager >
  First,  install package "geany-plugins" with Synaptic or 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 templates name,  for example:
        _pure_python.py
        _PyQt5.py

Optional - enable folding and simple syntax coloring for *.doc and *.txt 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;*.doc;*.txt;

  Better Option:  # based on    http://go-lang.cat-v.org/text-editors/geany/
    Goal: Add new Doc file type to filetype_extensions.conf,
      with folding and highligting equal to Python file type,
      but without highlighting Python keywords

    Copy Geany global config file to local configuration directory:
      cp     /usr/share/geany/filetype_extensions.conf      ~/.config/geany

    Add following to  ~/.config/geany/filetype_extensions.conf:
      Doc=*.doc;*.txt;             # between Docbook=... and Erlang=...

    Copy and rename following:
       cp     /usr/share/geany/filetypes.Python    ~/.config/geany/filedefs/filetypes.Doc.conf

    Edit following in   ~/.config/geany/filedefs/filetypes.Doc.conf:

      Comment out keywords list,  so will not be highlighted ( or substiute with your own,  eg Note, Warning,  etc)
        [keywords]
        #primary=....

      Enable python style folding and highligting
        [settings]
        extension=doc
        lexer_type=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=
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python modules for accessing the configuration of relevant paths Imago 1 1,324 May-07-2022, 07:28 PM
Last Post: Larz60+
Exclamation "System cannot find path specified"(Geany) kiwi99 2 3,774 Mar-18-2021, 07:37 PM
Last Post: kiwi99
  INI Configuration GUI goofygoo 4 4,448 Jul-19-2020, 08:47 PM
Last Post: goofygoo
  len() function, numbers doesn't work with Geany Editor Penguin827 3 2,938 May-08-2020, 04:08 AM
Last Post: buran
  Read Yaml configuration file in Python binhduonggttn 1 2,039 Feb-11-2020, 05:43 AM
Last Post: ndc85430
  Beginner Help - Geany and Cmder Pogosaur 2 3,150 Oct-09-2018, 02:15 PM
Last Post: Pogosaur
  Geany editor Mike429W 2 3,650 Sep-20-2018, 09:46 AM
Last Post: Mike429W
  help to execute a py code and good configuration andrebo 2 2,594 Sep-11-2018, 01:00 PM
Last Post: snippsat
  len() function doesn't work with Geany Editor hudabaig 2 3,550 Jun-01-2018, 11:20 PM
Last Post: wavic
  Geany 1.25 terminal not showing whitespace hudabaig 1 2,977 May-14-2018, 10:50 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020