Total Commander Forum

This is a community forum and not official technical support. — If you need official support: Contact Us

The following comments are owned by whoever posted them. We are not responsible for them in any way.

Back to Threads Reply to Thread

editing files with KATE

Hi,

Do you know of any way for editing files in total commander with kate (a linux program) instead of notepad.exe?.

Thanks,

Daniel

I don't see how that would be possible.

Maybe if you make a alias ( shortcut) to Kate and then choose the to alias as the default editor in T C

I've managed to open a file using kate from total commander. Here is how:

  1. Compile the below code using gcc (ex: gcc yourfile.c -o yourexec.exe). Keep the .exe extension as it will be easier to find it later from total commander:

include <stdio.h>

include <string.h>

int
main(int argc, char *argv[])
{
char buff[512], command[512], c;
int i, j=0, write=0;

    for (i=0; i<strlen(argv[1]); i++)
    {
            write = 1; // controls if the character will be written to buff or not
            c = argv[1][i]; // get the next character
            switch (i)
            {
                    case 0: // first character is always the drive leter.
                            switch (c)
                            {
                                    case 'y':
                                    case 'Y': // this is by default assigned to the user's home
                                            c = '~';
                                            break;
                                    case 'z':
                                    case 'Z': // this is by default assigned to the system's root folder
                                            write = 0;
                                            break;
                            }
                            break;
                    case 1: // this is always ':'
                            write = 0;
                            break;
                    default:
                            switch(c)
                            {
                                    case '\\': // convert backslash in slash
                                            c = '/';
                                            break;
                            }
            }

            if (write) // store the converted char in the temporary buffer
            {
                    buff[j] = c;
                    j++;
            }
    }
    buff[j] = 0; // end the temporary string nicely

    snprintf(command, 512, "kate %s", buff); // this is the linux command to run. It can be anything
    return system(command);

}



2. Copy the resulting binary to /usr/bin (or whatever other location you want) and give execute permissions to your user.  
3. Open total commander  
4. Go to Configuration -> Options -> Operation -> Edit/View  
5. Change the value for the "Editor for F4" to "Z:\usr\bin\yourexec.exe" (or the location you have chosen at step 2.)  
6. done

This method will work for any file with the name smaller than 8 chars. For files with longer names total commander truncates the name and changes it to upper case. Maybe somebody has an idea of how to overcome this limitation.

Best regards,

Daniel

CrossOver Forums: the place to discuss running Windows applications on Mac and Linux

CodeWeavers or its third-party tools process personal data (e.g. browsing data or IP addresses) and use cookies or other identifiers, which are necessary for its functioning and required to achieve the purposes illustrated in our Privacy Policy. You accept the use of cookies or other identifiers by clicking the Acknowledge button.
Please Wait...
eyJjb3VudHJ5IjoiVVMiLCJsYW5nIjoiZW4iLCJjYXJ0IjowLCJ0enMiOi02LCJjZG4iOiJodHRwczpcL1wvbWVkaWEuY29kZXdlYXZlcnMuY29tXC9wdWJcL2Nyb3Nzb3Zlclwvd2Vic2l0ZSIsImNkbnRzIjoxNzMxNDM1MjAzLCJjc3JmX3Rva2VuIjoiUFM2SnNaR3RmdWdlTTc1TSIsImdkcHIiOjB9