Hernan's blog

By Hernan, 14 years ago, In English
logo

Many people ask for the best IDE for programming contests where you don't need all the features than eclipse, Netbeans or VS has, there are many simple editors but only a few editors are really worth using.

Far Manager is a great tool for training in programming comptetitions because you can add lots of plugins avalible for it and extend the power like acced to ftp server, open compressed files, syntax highlighting, etc..

Far Manager has an simple editor than you can use for write source code and test data for a problem, you can also manage your files, preview text files and execute system commands to call compilers.



What is Far Manager?

The oficial site says:

" Far Manager is a program for managing files and archives in Windows operating systems. "

Download

You can download Far Manager here, i strongly recommend download the latest nightly build in archive mode.
After download is finished uncompress the .7z file in a folder called Far then run far.exe.

screenshoot

Far Manager Main Screen


The Basics

Read the problem statement of Theatre Square, i use the solutions of t__nt in C++ for explain the basics of Far Manager.

1: #include <cstdio>
2:
3: int n, m, a;
4:
5: int main() {
6: scanf("%d%d%d", &n, &m, &a);
7: printf("%lld\n", ((n + a - 1LL) / a) * ((m + a - 1LL) / a));
8: return 0;
9: }

The main screen contains two panels and the command line, you can rename, delete, create and view files or folders also copy or move files or folders between panels.

In the command line using the plugin farcmds you can call system commands like type echo and others.

screenshoot

Panels and Command Line

Make a folder called codeforces where you will put your source code pressing F7.

screenshoot

Making a folder


Type cd codeforces the press Shift + F4 for create a new file: theatre.cpp

screenshoot

Create a File


Now you can type the source code and save pressing F2.

screenshoot

Editor

Close the file pressing F10.
For compile the source code, assuming g++ is in the Path, type far:view <g++ -o theatre.exe theatre.cpp and you'll see the compiler messages, quit with F10 too.
Now create your input file theatre.in with the next content:

6 6 4

the solution for this test case is 4.

Run your program typing far:view <theatre <theatre.in

Syntax Highlighting

Colorer is a plugin for Far Manager than allow you highlight the source code for many languages, you can download here and uncompress into the Plugins folder.
After restart far you can view:


screenshoot

Editor with Colorer

Notes

You can use Far Manager in Linux if you have wine installed.
  • Vote: I like it
  • +10
  • Vote: I do not like it

| Write comment?
14 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Yeah, Far is a very powerful IDE. But to my mind it is useful only in olympiads and tiny projects. Using a debugger with Far is not a trivial task. Thus to debug a program one can use only console output and code reading. This forces you to search bugs not by tracing the program but by careful reading one line after another.

Being able to find bugs while reading the code is very useful in ACM-like contests. A computer is a bottleneck so it's better to use it for writing solutions than for searching bugs.

  • 14 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Our team solved this problem.

    At the beginning we created a project in Visual Studio called "template" with one file: solution.cpp

    When we are going to solve problem X, we just copy "template" project into X directory and start to write code in solution.cpp file. If anything goes wrong, we just press Enter at the template.vcproj file and Visual Studio opens, ready to debug our code, written in Far.

  • 14 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    When I use far as IDE for olympiads, i used gdb as debugger.
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Thank you for this useful article. I didn't know about far:view feature even though I have been using FAR for 1 year. However, all these far:view, far:edit and other commands don't work when you set "Execute command " in "File association" menu. Do you know any workaround for this issue?
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
For GNU/Linux a similar tool is Midnight Commander.
  • 14 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it
    Midnight is awful for editing files! Of course, as a commander it seems to be a good alternative to far manager, but did you try to code your problems in it? Pressing escape twice to exit the file; strange chars when opened in Windows...
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      Pressing escape twice to  exit the file
      It's customizable;
      strange chars when opened in Windows
      Looks like you're using a bad editor in Windows. In Unix-like systems there is only one byte for line break, unlike Windows with two bytes. So when such files are opened in Notepad, they look strange, but in normal editors everything is OK ;)
  • 14 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    I agree with mak_kbtu. MC had a lot of small imperfections comparing with Far, or may be it's just matter of your habits.
    But it's hard to me write or navigate in MC, so I still using vim+bash+kate under linux :)

    • 11 years ago, # ^ |
      Rev. 2   Vote: I like it +6 Vote: I do not like it

      vim + Kate? How does that work together? :D

      • 11 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Kate is a main editor (for code, samples, etc) and vim is used when I need to create or fix some file which is not opened in Kate (or if I don't want to switch windows). Another usecase is to open very big file (editors usually fail with this one).

14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Can I create a template for some file extensions? For ex: if I will create "problem.cpp", there will be prepared code: "#include<...> using namespace std ....".
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
To the point, did you get Far Manager to work under Linux? When I installed it under wine, the plugins work rather well, but I couldn't run far and compilation commands. If you or someone managed to cope with this problem, please, share!
  • 3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The project far2l is now functional and wonderful!

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In Linux I used gedit with MC

»
11 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

I think I'm not really getting it. What is the advantage of this over a good shell + editor combination like GNU EMACS or vim? Scriptability is hardly a good argument because any given piece of GNU software can be scripted

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can you compare this program with Vim/gVim. Vim is also a powerful tool too.

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I am trying to compile in far manager, if i install g++ on terminal it will compile? what i have to do ?

»
9 years ago, # |
  Vote: I like it +5 Vote: I do not like it

For anyone curious, the syntax highlighting is included "since post build 3200", so if you download one of the newer builds of far manager, far colorer(the syntax highlighter) is already included.

»
9 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

I will strongly recommend Geany for Linux. It's very simple and you don't have most of the unuseful things that Eclipse and other IDEs have. I haven't tried it on Windows but I thing there is a version for it.

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to set up and use indentation in Far manager ??

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    F9 — Options — Editor settings. I'd recommend checking "Auto indent" and adjusting "Tab size". You can also use Alt+I for adding one space of identation to the selected block and Alt+U for removing one space of identation.

    P.S. I'd also recommend checking "Del removes blocks" (otherwise Del will remove just one character and not the selection),

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it +13 Vote: I do not like it

      Thanks a lot :)

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it -10 Vote: I do not like it

      How can I select a block to delete? Ctr + A is useful but I can't select a block which I want to delete.Please Help :)

      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it +10 Vote: I do not like it

        As you would do in almost any Windows editor (Word, Notepad, Notepad++): hold Shift (current text cursor position will be selection block's start) and move text cursor with arrows/Home/End/PgUp/PgDn/etc to choose selection block's end.

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it -10 Vote: I do not like it

      What's the meaning of [x] before the setting operations?

      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        [ ] is like a checkbox in GUI — it's either unchecked ([ ], meaning "option is disabled") or checked ([x], meaning "option is enabled").

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I still have a problem to set Macro so that I needn't to input a long instruction to compile or compile and run my cpp files, can you tell me how to do it?

          • »
            »
            »
            »
            »
            »
            8 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            You'd better use file associations for that. What exactly do you want your macro to do and in which situation?

            • »
              »
              »
              »
              »
              »
              »
              8 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              As your suggestion, I want to compile and run my program just type Ctrl + F9(for example) with defined Macro, so where and how should I to edit my Macro?

              • »
                »
                »
                »
                »
                »
                »
                »
                8 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Macros work on very low level: they just emulate key presses. So, for example, macro configured to compile and run from inside the editor won't work in other situations (moreover, it would do something ridiculous).

                You start from the situation where you want to run your macro, press Ctrl+Shift+dot once, then perform all necessary actions to compile the program (avoid typing filename, for example, as it may be different in different times), then press Ctrl+Shift+dot once again. Then set a hotkey for the macro. Then, whenever you will press that hotkey, your macro will be played.

                You will probably get something like Escape; Enter — exit the editor, then compile the file (via file associations).

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                  Rev. 2   Vote: I like it 0 Vote: I do not like it

                  How would you accommodate for different file names? Additionally, how would you delete the entire line the cursor is at? Ctrl+Shift+Backspace tends to be too time consuming.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  If you talk about file associations, use special symbols (press F1 in the "Edit file association" window to get help — English is available as well). The most useful is ! — file name without extension. So, my compilation command is g++ !.cpp -o !.exe -ggdb -DDEBUG -std=c++11 -O2 -Wl,--stack=256000000 -Wall -Wextra -Wshadow

                  Ctrl+Y deletes current line. Again, you can get list of hotkeys by pressing F1 in the editor.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  How to install that g++ thing? I downloaded installation file from here https://sourceforge.net/projects/mingw/ and then marked all stuff in "Basic Setup" and installed it. I didn't restart computer, but Far Manager still doesn't recognize g++ option.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  @IAmNomad you must set the path in your environment variables(in windows) to that of the bin folder of mingw. You can google setting up a path for gcc to get a detailed solution. After setting the path I think a restart of FarManager is enough(I am not sure for me I had sublime and restart was enough).

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  Thanks, worked!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  8 years ago, # ^ |
                  Rev. 2   Vote: I like it 0 Vote: I do not like it

                  Why does error "The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library C:\Work\sol.exe" occur?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  Solution is easy: add -static-libgcc -static-libstdc++

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  I know this is a little late but I can't seem to locate this in the English documentation.

                  How do you find the absolute path of a file in far manager and push it to the clipboard?

                  I have seen on multiple screencasts of yours and Gennady's that you copy the path of a file from Far and paste it into the website for quick submission.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                  Rev. 2   Vote: I like it 0 Vote: I do not like it

                  Looks like you can press Ctrl+Alt+Insert to copy full path of the selected file into clipboard. I didn't know that yet, thank you! Found that under F1 — Keyboard reference — Panel Control.

                  My previous workflow was to put selection on .., press Ctrl+Enter to type full directory path in command line, then press Ctrl+Insert to copy command line's content into clipboard, then press Ctrl+Home to move cursor to command line's beginning and finally press Ctrl+K to remove everything in the command line till its end. Now I have directory's path in the clipboard, I can paste it into file selection dialog and the select the file with mouse.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  for example, I set ctrl + F9 equals "g++ !.cpp -o !.exe -ggdb -DDEBUG -std=c++11 -O2 -Wl,--stack=256000000 -Wall -Wextra -Wshadow", when I was editing A.cpp, I ran ctrl + F9, but nothing happened, why?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it +3 Vote: I do not like it

                  How exactly did you set Ctrl+F9 to run something? Maybe it's for file panes only?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  yes, I set it at file panes, what's the correct way to set it? thanks

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it +4 Vote: I do not like it

                  How exactly did you set Ctrl+F9 to run something?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  press ctrl + shift + dot and then press all the compile command and press ctrl + shift + dot again and then enter ctrl + F9

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  I see. It's called a macro, and it simply remembers what keys you've pressed and repeats them once you press Ctrl+F9. Say, if you've recorded these commands while being in the file pane, they probably do something very stupid when being run from the editor.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  SO what's the correct way to do this ? QAQ

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  7 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it
    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How can we use snippets (like in sublime text) in far manager?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        I don't think it's a built-in functionality, but you may try plugins like True Template or Text Templates. I haven't used any of them, though.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Hi, I have a question. How do I install the True Template? I used the github files, but couldn't find any .dll files for the True Template. Hence, there still doesn't exist any Plugin Commands for the template in Far.

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I know its late but for anyone who has the same issue, this is the latest version as for now.. TrueTemplate-3.0.2.zip

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
              Rev. 2   Vote: I like it 0 Vote: I do not like it

              oh, thanks a lot.

              btw, should i just extract them the files into the Plugins folder of Far Manager?

              UPD: yeah, it works. that's a relief.

              • »
                »
                »
                »
                »
                »
                »
                »
                4 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                np, btw have you ever faced crash while saving file with F2 key? Its really annoying me during live contests(crash has managed to happened at the worst possible time multiple times now) and i dont want to switch to vim permanently :(

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      sir yeputons

      don't we have auto completion and automatic templates in far manager ?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Never heard of that and never used. Maybe there are some plugins.

»
8 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Well, it was not me who started necroposting. Rumors there are, FAR is now available for Linux

»
6 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

Well,when I When I type a newline,the cursor will always return to the beginning of the line.How can I solve this problem?In my opinion,when I type a new line ,the cursor will align with the previous line.

I want :

for(int i=1;i<=n;i++){
  for(int j=1;j<=m;j++){

  }
}

but not :

for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){

}
}
  • »
    »
    6 years ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    Enable autoindent feature in the editor settings.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

      thanks,I did not read all the above exchange,yeputons had already solved this problem ,he said `F9 — Options — Editor settings. I'd recommend checking "Auto indent" and adjusting "Tab size". You can also use Alt+I for adding one space of identation to the selected block and Alt+U for removing one space of identation.

      P.S. I'd also recommend checking "Del removes blocks" (otherwise Del will remove just one character and not the selection),`

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

nice tutorial

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I can't seem to compile my C++ program when following Hernan's instructions. I have the right g++ and gdb. Can someone help me? Thanks in advance.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Far is great. However I cant use Auto Bracketing which was my favourite feature. Has anybody solved this issue?

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I dont think so you can use auto bracketing in far manager.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How do I comment multiple lines in Far Editor?

Ctrl+/ isn't working

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think this is the one tourist uses as his Editor

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Don't you think tagging him is unnecessary :/

»
4 years ago, # |
Rev. 3   Vote: I like it -10 Vote: I do not like it

.

»
4 years ago, # |
  Vote: I like it -17 Vote: I do not like it

yeputons sir, My Far Manager crashes sometimes when i save changes made to my code and then i have to restart far and the changes which i made are not saved and i cant find anything on the internet...unfortunately, i cant keep using far during contests if this continues, please help.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If someone is facing a similar issue, I was previously running Far from the shortcut I pinned to my taskbar but now I always run Far from CMD and it has never crashed since, so that's that and finally, many thanks to this wonderfully supportive thread.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Ancient thread, but for mac users, here is a port that I just discovered today — https://github.com/elfmz/far2l. Works almost flawlessly!

»
18 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it