Hi
Nano may just be the sweet spot for 95% of my editing needs - I am a non-compiling windows user!
I like a portable installation on my USB stick and have a batch file to load nano.exe - below.
As the key bindings were unfamiliar I have used AutoHotKey to translate (also sends mouse wheel and paste from windows clipboard) - below.
With the simple things done I have run in to the "Not supported on Windows yet" message with the following commands:
linter
I would love to call the Lua linter - LuaCheck.exe
https://github.com/mpeterv/luacheck
execute: In order to cut/copy to the windows system clipboard I would like to invoke clip.exe with the contents of the nano cutbuffer. https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/clip
In order to run the file/script I am editing I would like to invoke shelexec.exe with the current filename. http://www.naughter.com/shelexec.html
In order to manipulate blocks of text I would like to pipe the current selection to a Lua script and insert the returned text.
speller: I use a windows compiled version of hunspell.exe - could this be called from nano-win? https://github.com/iquiw/hunspell-binary/releases/tag/v1.7.0
I guess the execute command is the key to all of these limitations, is there any chance of nano-win being patched to enable execute, flippipe, flipexecute, flipnewbuffer?
Very grateful for any insights, and many thanks for posting binary releases of nano-win (https://files.lhmouse.com/nano-win/) for us mere mortals.
Kind Regards Gavin Holt
nano.bat:
@echo off
REM Run Nano as a portable application
REM See autohotkey for keyboard reassignment
REM Change to this batch directory
CD /D %~dp0
REM Maximise console size
tools\cmdmax.exe
REM Use a color theme
tools\colortool.exe -q tools\themes\textadept.ini
REM Set title so autohotkey can find it!
title nano.exe
REM Run with local rc file
REM nano.exe --rcfile=nano.rc %*
exit
autohotkey script:
; Nano enhancements
#If WinActive("Administrator: nano.exe") or WinActive("nano.exe")
{
; --zap is set
;
^':: Send ''{Left}
^2:: Send ""{Left}
^9:: Send (){Left}
^0:: Send (){Left}
^[:: Send []{Left}
^]:: Send []{Left}
^5:: Send %
%{Left}
^+[:: Send {{}{}}{Left}
^+]:: Send {{}{}}{Left}
^TAB::Send !.
^+TAB::Send !,
^Up::Send !q
^Down::Send !w
WheelUp::Send ^p^p^p
WheelDown::Send ^n^n^n
^a::Send ^{Home}+^{End} ; Select all
^b::Send ^a ; BOL
!b::return ; disable invoke linter
^+b::Send +{Home} ; Select BOL
^c::Send !6 ; Copy to local cutbuffer
; ^d::return ; disable del, Can't find a way to duplicate block
; ^e:: Built in :) ; EOL
+^e::Send +{End} ; Select EOL
^f::Send ^w ; Find text
+^f::Send ^/ ; Find RE
^g::Send ^_ ; Goto
^h::Send ^\ ; Replace
^!i::Send ^r ; Insert file
^j::Send !] ; Jump brackets
!j::return ; disables justification
^+j::return ; disables justification
^k::Send +{End}{Backspace} ; kill right
^+k::Send +^a{Del} ; kill left
^l::return ; disable centre line
!l::return ; disables toggle hard wrapping
^m::Send !a ; set/unset mark
^n::Send ^t{Enter} ; Execute not supported - but used to make a new buffer
^o::Send ^r^t ; Open browser
!o::^o ; Export selection or whole file
^p::Send ^u ; Paste
^q::Send !3 ; Line quotes
^r::return ; disable read, Can't work out how to revert to file copy
; ^s:: Built in :) ; Complains if backup set
^t::return ; disable execute
!t::return ; disable cutting to end of file
^v::^u ; Paste from local cutbuffer
^RButton:: SendInput {RAW}%ClipBoard% ; Paste from system buffer
^w::Send ^x ; Close
^x::Send ^k ; Cut to local cutbuffer
^y::Send !{Del} ; Delete sel or line
^z::Send !u ; Undo
^+z::Send !e ; Redo
Esc::Send {F12} ; Will be interpreted using bindings in nano.rc
F2::Send !{PgDn} ; Next bookmark
^F2::Send !{Ins} ; Toggle bookmark
+F2::Send !{PgUp} ; Previous bookmark
^/::^t
^Enter::^] ; Complete word
}
nano.rc:
set atblanks
set autoindent
unset backup
unset backupdir "..\zBackup"
set brackets ""')>]}"
unset constantshow
set fill -8
set linenumbers
set matchbrackets "(<[{)>]}"
set mouse
set multibuffer
set nohelp
set numbercolor white,black
set indicator
set positionlog
set punct "!.?"
set quickblank
set showcursor
set smarthome
set softwrap
set tabsize 4
set tabstospaces
set trimblanks
set zap
include "properties/awk.nanorc"
include "properties/batch.nanorc"
include "properties/css.nanorc"
include "properties/cmake.nanorc"
include "properties/default.nanorc"
include "properties/html.nanorc"
include "properties/ini.nanorc"
include "properties/javascript.nanorc"
include "properties/lua.nanorc"
include "properties/makefile.nanorc"
include "properties/markdown.nanorc"
include "properties/moonscript.nanorc"
include "properties/sed.nanorc"
include "properties/text.nanorc"
include "properties/vi.nanorc"
bind F12 cancel all
bind F12 exit main
bind F12 exit browser
bind F12 exit help