Skip to content

Commit

Permalink
Fix nanorc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Nov 19, 2024
1 parent 7d55c79 commit 2ff533c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Set up nano in Debian-like systems.
* `nano_nanorc_destinations.key.mode`: The mode of the file, such as 0644 (optional, default `0644`)

* `nano_tabsize`: [default: `2`]: Tab size
* `nano_tabstospaces`: [default: `true`]: Whether or not to convert typed tabs to spaces
* `nano_smooth_scrolling`: [default: `true`]: Whether or not to use smooth scrolling
* `nano_tabstospaces`: [default: `true`]: Whether to convert typed tabs to spaces
* `nano_smooth_scrolling`: [default: `true`]: Whether to use smooth scrolling (version `< 5.6.1`)

* `nano_improved_nanorc_install`: [default: `true`]: Whether or not to install [improved syntax highlighting](https://github.com/nanorc/nanorc)
* `nano_improved_nanorc_install`: [default: `true`]: Whether to install [improved syntax highlighting](https://github.com/nanorc/nanorc)
* `nano_improved_nanorc_langs`: [default: `all`]: Languages to enable after installation
* `nano_improved_nanorc_git_repo`: [default: `https://github.com/nanorc/nanorc`]: The repository url
* `nano_improved_nanorc_git_branch`: [default: `master`]: The branch to checkout
Expand Down
24 changes: 24 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@
- nano
- nano-install

- name: get (current) version # noqa risky-shell-pipe
ansible.builtin.shell: >
nano --version 2>&1 | head -1 | awk '{print $NF}'
register: _get_current_version
changed_when: false
check_mode: false
failed_when: "_get_current_version.rc != 0"
tags:
- configuration
- nano
- nano-version
- nano-version-get

- name: set (current) version
ansible.builtin.set_fact:
nano_version: "{{ _get_current_version.stdout | regex_search('^([0-9]+\\.[0-9]+\\.?[0-9]*)$') }}"
changed_when: false
check_mode: false
tags:
- configuration
- nano
- nano-version
- nano-version-set

- name: install improved nanorc
ansible.builtin.import_tasks: install-improved-nanorc.yml
when: nano_improved_nanorc_install | bool
Expand Down
4 changes: 4 additions & 0 deletions templates/etc/nanorc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,24 @@ set nowrap
## beginning of the line.
# set smarthome

{% if nano_version is version('5.6.1', '<') %}
## Use smooth scrolling as the default.
{% if nano_smooth_scrolling %}
set smooth
{% else %}
# set smooth
{% endif %}
{% endif %}

## Use this spelling checker instead of the internal one. This option
## does not properly have a default value.
##
# set speller "aspell -x -c"

{% if nano_version is version('6.3', '<') %}
## Allow nano to be suspended.
set suspend
{% endif %}

## Use this tab size instead of the default; it must be greater than 0.
{% if nano_tabsize %}
Expand Down

0 comments on commit 2ff533c

Please sign in to comment.