How to use vim shortcuts with Notepad++ - editor

I have to use Notepad++ and not the Windows version of vim because I am sure that Notepad++ does not insert odd characters to the end of lines. I am editing my dev box, so I have to edit from Windows, but a lot of editors are adding odd characters to my files. I like using vim key shortcuts because they are efficient. Is there a way to use Vim shortcuts with Notepad++?

I suspect you are seeing nothing more than the difference in end of line marking between Windows and Unix.
So to fix the issues you are seeing just configure your editor to use the correct end of line marker.

Related

Delphi CnPack - Shortcut for Code formatting

I have installed CnPack (https://www.cnpack.org) to get. At least, a little bit of the experience you get with VS Code. CnPack is a really great tool and I don't want to miss it, but it overwrites the default Shortcuts of Delphi RAD Studio. After Installation, I miss the Shortcut for automatic code formatting. Usually it is CTRL + D. I found that CnPack has also Code Formatting ability, but I could not find the manuals for it, and therefore I could not find the keyboard shortcuts for that. Any experience with that?

Tips on unicode text editors

I am currently converting a legacy system to a new platform and need to extract strings from the old systems resource files.
The old system was written in Delphi and the strings are kept in files called .dfm. I have no trouble locating the strings and for English and other European languages there is no problem. The trouble comes when I try to extract strings in Japanese. I have used Notepad++ and it seems to me that the program don´t recognice the correct encoding. I get Japanese symbols but they don´t seem to match what is in the GUI. Notepad++ shows signs in something called GB2312(Simplified Chinese). But it looks weird.
My question is, does anyone have any tips on programs/text editors that are good at operations like this?
Also I'm grateful for any tips that might help me along the way.
Assuming that your issue is simply that Notepad++ is incorrectly guessing the encoding you can solve the problem by manually setting the encoding in Notepad++, like this:
Notepad++ itself already handles encoding issues. To make it to desired encoding, like Unicode;
first, copy all the contents of the file,
choose Unicode without BOM in the menu,
last, replace all contents with copied contents
save the file
Your contents will then be in your desired encoding.
Strings are kept not [just] in DFMs in Delphi. Only forms and associated text are. So you would to review all the code as well.
As for DFMs - before Delphi 2009 DFMs didn't use Unicode so you must know what charset was used. That was one of big problems with localization and internationalization of Delphi applications.

Plugin for text navigation in Delphi

I am using delphi 2010, and I am used to work on emacs. Really I would like to do most of my editing on a more emacs, vi way but without go out of it. Is there anyway to do so?
I don't know emacs but it's probably possible by writing a custom keyboard binding.
Update: Delphi already includes a keyboard binding called "New IDE Emacs", check it out (go to Tools\Options\Editor Options\Key Mappings).

delphi 2007 command line compiler dcc32.cfg problem

I'm using the command line compiler for builds. One problem I see is that the paths mentioned there seem to need to be the short versions of the filenames such that they don't contain any spaces. I don't know so much about this even though I have used it for some time.
I recently upgraded to d2009 and the problem started then.
Is there a way around shortening the path?
I should say I'm not eager to change to use the MS Build tool at this time. I just want to build an old copy of my app & get back to other work.
Here's the path used in the dcc32.cfg file for the -I, -U, -O, and -R parameters:
$(BDS)\LIB;$(BDS)\Imports;$(BDS)\Lib\Indy10;C:\PROGRA~1\Borland\BDS\4.0\RAVERE~1\Lib;c:\prj\lib\lib2002;C:\DOCUME~1\ALLUSE~1\DOCUME~1\RADSTU~1\5.0\Bpl;c:\DOCUME~1\mike\MYDOCU~1\BORLAN~1\bpl;C:\Prj\Lib\LOCKBO~1\source;C:\Prj\Lib\MyComp;C:\Prj\Lib\ABBREV~1\source;C:\Prj\Lib\ZLib;C:\Prj\Lib\MinMod;C:\Prj\Lib\HELPMA~1;C:\Prj\Lib\DXGETT~1;c:\windows\system32;c:\prj\lib\xpburn;C:\Prj\Lib\WININE~1;C:\Prj\Lib\regexpr\Source;C:\Prj\Lib\VCARDR~1;C:\PROGRA~1\Raize\RC4\Lib\BDS2006;C:\Prj\Lib\jcl\lib\d10;C:\Prj\Lib\jcl\source;C:\Prj\Lib\jvcl\lib\D10;C:\Prj\Lib\jvcl\common;C:\Prj\Lib\jvcl\RESOUR~1;C:\Prj\Lib\ProE6\Delphi;C:\Prj\Lib\FastMM4;C:\Prj\Lib\OPENOF~1;C:\Prj\Lib\DEVELO~1\Library\Delphi11;C:\Prj\Lib\DEVELO~1\EX38D9~1\Sources;C:\Prj\Lib\DEVELO~1\EXBD88~1\Sources;C:\Prj\Lib\DEVELO~1\XPTHEM~1\Sources;C:\Prj\Lib\DEVELO~1\EX2EBC~1\Sources;C:\Prj\Lib\DEVELO~1\EXC5FB~1\Sources;C:\Prj\Lib\DEVELO~1\EX7C7C~1\Sources;C:\Prj\Lib\DEVELO~1\EXPRES~3\Sources;C:\Prj\Lib\DEVELO~1\EXPRES~4\Sources;C:\Prj\Lib\DEVELO~1\EXC73B~1\Sources;C:\Prj\Lib\DEVELO~1\EX7165~1\Sources;C:\Prj\Lib\DEVELO~1\EXPRES~2\Sources;C:\Prj\Lib\DEVELO~1\EXPRES~1\Sources;C:\Prj\Lib\DEVELO~1\EX749C~1\Sources;C:\Prj\Lib\DEVELO~1\EX0A1A~1\Sources;C:\Prj\Lib\Mad\madBasic\BDS4;C:\Prj\Lib\Mad\MADDIS~1\BDS4;C:\Prj\Lib\Mad\MADEXC~1\BDS4;C:\Prj\Lib\Mad\MADKER~1\BDS4;C:\Prj\Lib\Mad\MADSEC~1\BDS4;C:\Prj\Lib\Mad\madShell\BDS4;C:\Prj\Lib\Mad\madShell\DeXter;C:\Prj\Lib\Mad\madExcept\..\Plugins;
I've copied it from the IDE's path like I have done in the path and used a program to shorten the path names.
Although there are no spaces in that path, it still can't find indy's IdCoder.dcu at C:\Program Files\CodeGear\RAD Studio\5.0\lib\Indy10
According to the d2007 environment variables, $(BDS) would apparently expand to c:\program files\codegear\rad studio\5.0
The IDE is considering this library path to be valid.
Why is this happening? I bet it's a simple mistake I haven't thought of!
Thank you for your help!
You could try to put the paths in quotes, that's the standard way of handling path-/filenames with spaces in Windows, though I never tried that in Delphi DCUs.
So, instead of
$(BDS)\Lib\Indy10
try
"$(BDS)\Lib\Indy10"
You could also try
"C:\Program Files\CodeGear\RAD Studio\5.0\lib\Indy10"
to check if the environment variable is correct.
Although .cfg files do still work in the Delphi 2007 command line compiler, you should really be using MSBuild to compile your projects. CFG files are not used by the IDE anymore. Any compiler options you set design time do not get written to the .cfg file. Using MSBuild is not harder then using .cfg. And if you want it is even more flexible since you can change the actual build processes.
msbuild YourProject.dproj
Delphi actually will give you the command line needed in the output tab when you do a compile or build.
Build your project normally in Delphi.
At the bottom there will be a tab called "Output", Look for a line that says "Target CoreCompile" (in D2007 - may be different in other versions). The line below that will be the command line used to build your project (This is what you want). Btw - you do not have to wait for your project to complete building, you can hit cancel before it finishes because all you need is that DCC32 command line call. Also, if you had done previous compiles you may want to right click and clear the output before building so you do not have a lot of "noise".
Click on that line to highlight it, then right click the line and choose copy.
Open an empty batch file and paste. (warning,the line may be very long)
Now, go to the start of that line and if your path to the DCC32 compiler includes a space, then you will need to put quotes around the DCC32 call, don't put the quotes around the parameters.
Insert a line above the DCC32 call and enter dos commands to set the directory to the directory where your dpr file is, otherwise DCC32 will say it cannot find your project. For example.
G:
then
cd \Apps\MyProject
Save the batch file and you are ready to go.
Is the $(BDS) environment variable set when you're compiling the program from the command-line? If not, that might be the problem.
Putting quotes around paths containing spaces will likely solve the problem with spaces. This has worked for me:
-U"C:\Path to libraries\First library;C:\Path to libraries\Second library;C:\Path to libraries\Third library"
Check if you have applicationname.cfg file in the current folder. Dcc32 will try to read configuration from that file first. Only if the file does not exist will it read from dcc32.cfg.

Stand-alone text editor with Visual Studio editor functionality

Is anyone aware of any text editors with Visual Studio editor functionality? Specifically, I'm looking for the following features:
CTRL+C anywhere on the line, no text selected -> the whole line is copied
CTRL+X or SHIFT+DEL anywhere on the line, no text selected -> the whole line cut
Thanks!
Komodo Edit does the two things you specified.
I use it all the time as a secondary editor, for various scripting and other programming tasks. Tons of features, free, open source.
Zeus can emulate the Visual Studio keyboard.
To change the keyboard mapping just use the Options, Editor Option menu and in the Keyboard panel and select the MSVC as the active keyboard mapping.
(source: zeusedit.com)
Notepad++, UltraEdit and TextPad are good ones.
EditPad Pro will cut or copy the line the cursor is on when no text is selected. People sometimes report that as a bug.
Twistpad looks something like Visual Studio 2005/2008 editor and seems has the same key bindings, including Ctrl-X to cut whole line if no text was marked.
Slickedit
Not to steal Chris' thunder for his suggestions on Notepad++, UltraEdit, and TextPad, but I would like to point out that there is a version of UltraEdit which can be run from a thumb drive (for those people who lack Admin rights at work and can not install programs).

Resources