FAR3: Simple LUA macros by me

Here you can discuss any topic concerning Far macro commands.
Post Reply
cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39
Been thanked: 2 times

FAR3: Simple LUA macros by me

Post by cyberwolf »

Here are a few LUA macros i use, they might be useful to others (I'll add more if i manage to make any other :) )

1. This macro will start the search dialog and paste the current selection into it.
Note : if there's no selection then the current row is selected and pasted


2. I have a lot of folders that start with "!" or "~" (they are named like that so they are at the start of the list of folders when sorted by name).
The problem is that Alt+Shift+` doesn't always start the "file search" dialog. This macro fixes that.


Edit: fixed name of 2nd script (i should probably pay more attention when copy/pasting code :facepalm: )
Edit2: removed the unnecessary return from the first script
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA
2useven10
Posts: 4072
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 5 times
Been thanked: 189 times

Re: FAR3: Simple LUA macros by me

Post by 2useven10 »

DisableOutput flag is obsolette. It is default. If you need use opposite EnableOutput flag.
cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39
Been thanked: 2 times

Re: FAR3: Simple LUA macros by me

Post by cyberwolf »

2useven10 wrote:DisableOutput flag is obsolette. It is default. If you need use opposite EnableOutput flag.
Thanx, i didn't know that, i'll update the macros.
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA
User avatar
HaRT
Moderator
Posts: 9527
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 109 times
Been thanked: 228 times

Re: FAR3: Simple LUA macros by me

Post by HaRT »

cyberwolf
Thank you for sharing these.
Can you please correct the second spoiler name as it's the same as the first one.
Фар есть инструмент, а не нянька. © 2009 DrKnS
User avatar
John Doe
Бюрократ
Posts: 12872
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 38 times
Been thanked: 293 times

Re: FAR3: Simple LUA macros by me

Post by John Doe »

editor.searchforselectedtext
There is no need to return value from function action.
cyberwolf wrote:2. I have a lot of folders that start with "!" or "~"
[...]
The problem is that Alt+Shift+` doesn't always start the "file search" dialog.
I am unable to reproduce your problem
cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39
Been thanked: 2 times

Re: FAR3: Simple LUA macros by me

Post by cyberwolf »

John Doe wrote:editor.searchforselectedtext
There is no need to return value from function action.
cyberwolf wrote:2. I have a lot of folders that start with "!" or "~"
[...]
The problem is that Alt+Shift+` doesn't always start the "file search" dialog.
I am unable to reproduce your problem
I thought i had to, i don't know where i got the idea that it needs to (i might have taken the idea from the condition function). I'll edit the first post and remove the return from it.

The problem with the "~" character is something related to the computer (or maybe the OS) not FAR. I work on 3 computers and on 2 of them if i press the ` or " button it doesn't show the character immediately, i need to press it again or press space. It's probably related to the localization since if i press the ' and then a i get the á character (same for " followed by a will be transformed into ä). On the 3rd computer (my home computer) this problem doesn't exist, i made the macro to overcome this problem on my work computers.

P.S. sorry for the many errors, i'm still a beginner at LUA and FAR scripting so i'm probably making some other mistakes too :)
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA
Post Reply

Return to “Macro Commands Discussions”