Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Far Manager (часть 3)

Модерирует : gyra, Maz

articlebot (06-10-2016 09:08): Far Manager  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Alexyz21



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
 
Если нажать AltG, то файл MacroBrowserAlt.lua будет открыт в редакторе и курсор будет установлен в данную позицию на hDlg.

Код:
-- http://forum.ru-board.com/topic.cgi?forum=5&topic=31718&start=7620#6
 
local F = far.Flags
local GInfo=function()
  local ei=editor.GetInfo(-1)
  local y,x,p = ei.CurLine,ei.CurPos,ei.LeftPos
  local l=editor.GetString(-1,y).StringText
  return l,y,x,p
end
 
local function FileSave(t)
  editor.Editor(t[1][1],_,_,_,_,_,bit64.bor(F.EF_NONMODAL,F.EF_IMMEDIATERETURN,F.EF_OPENMODE_USEEXISTING))
  for j=2,#t do editor.SetString(-1,t[j][1],t[j][2]) end
  if not editor.SaveFile(-1) then msgbox("Warning! File is not saved - blocked?",t[1][1]) else editor.Quit(-1) end
end
 
Macro {
area="Editor"; key="AltG"; flags=""; description="RESearch: 1. Grep Goto line";  
condition=function() return editor.GetInfo(-1).FileName:match('\\gre%w-%.tmp$') end;
action=function()
local fd=Far.DisableHistory(-1)
local l,y,x,p = GInfo()
local n,s=l:match('^(%d-):(.+)$')
if n then
  Keys('F7') print('^[A-Z]:') Keys('AltC subtract AltW subtract AltG add AltV add Enter')
  l=GInfo() l=l:match('^([A-Z]:.+):') --GetFileName
  editor.SetPosition(-1,y,x,_,_,p)
  if l then
    editor.Editor(l,_,_,_,_,_,bit64.bor(F.EF_NONMODAL,F.EF_IMMEDIATERETURN,F.EF_OPENMODE_USEEXISTING),tonumber(n),x-#n-1)
    editor.SetPosition(-1,_,_,_,_,p-#n)
  end
end
Far.DisableHistory(fd)
end;
}
 
Macro {
area="Editor"; key="AltG"; flags=""; description="RESearch: 2. Grep Save line";  
condition=function() return editor.GetInfo(-1).FileName:match('\\gre%w-%.tmp$') end;
action=function()
local fd=Far.DisableHistory(-1)
local l,y,x,p = GInfo()
local n,s=l:match('^(%d-):(.+)$')
if n then
  Keys('F7') print('^[A-Z]:') Keys('AltC subtract AltW subtract AltG add AltV add Enter')
  l=GInfo() l=l:match('^([A-Z]:.+):') --GetFileName
  editor.SetPosition(-1,y,x,_,_,p)
  if l then
    editor.Editor(l,_,_,_,_,_,bit64.bor(F.EF_NONMODAL,F.EF_IMMEDIATERETURN,F.EF_OPENMODE_USEEXISTING),tonumber(n),x-#n-1)
    editor.SetString(-1,n,s)
    if not editor.SaveFile(-1) then msgbox("Warning! File is not saved - blocked?",l) else editor.Quit(-1) end
  end
end
Far.DisableHistory(fd)
end;
}
 
Macro {
area="Editor"; key="AltG"; flags=""; description="RESearch: 3. Grep Save All";  
condition=function() return editor.GetInfo(-1).FileName:match('\\gre%w-%.tmp$') end;
action=function()
local fd=Far.DisableHistory(-1)
local t={}
for i=1,editor.GetInfo(-1).TotalLines do
  local l=editor.GetString(-1,i).StringText
  local y,s = l:match('^(%d-):(.+)$')
  if y and s and #t>=1 then table.insert(t,{y,s})
  else
    local f,n = l:match('^([A-Z]:.+):(%d+)$')
    if f and #t>1 then FileSave(t) t = {} t[1]={f,n}
    elseif f and #t<=1 then t[1]={f,n}
    end
  end
end
if #t>1 then FileSave(t) end
Far.DisableHistory(fd)
end;
}
 

Всего записей: 3484 | Зарегистр. 16-06-2007 | Отправлено: 23:42 14-09-2015 | Исправлено: Alexyz21, 09:13 24-02-2016
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Far Manager (часть 3)
articlebot (06-10-2016 09:08): Far Manager


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru