Relative line numbers in Visual Studio
Since VSCode 1.6 you can set editor.lineNumbers with the value of relative in the settings.json file or in File>Preferences>Settings.
Since VSCode 1.6 you can set editor.lineNumbers with the value of relative in the settings.json file or in File>Preferences>Settings.
You can use an AtomicInteger as a mutable final counter. public void test() throws IOException { // Make sure the writer closes. try (FileWriter writer = new FileWriter(“OutFile.txt”) ) { // Use AtomicInteger as a mutable line count. final AtomicInteger count = new AtomicInteger(); // Make sure the stream closes. try (Stream<String> lines = Files.lines(Paths.get(“InFile.txt”))) … Read more
The following query helps you to get the count cat FILE_NAME | wc -l
The __LINE__ literal is documented in the Special Literals section of the perldata man page. print “File: “, __FILE__, ” Line: “, __LINE__, “\n”; or warn(“foo”);
Here is one that allows you to click on the output pane: (There are also some other nice tips there) http://www.highprogrammer.com/alan/windev/visualstudio.html // Statements like: // #pragma message(Reminder “Fix this problem!”) // Which will cause messages like: // C:\Source\Project\main.cpp(47): Reminder: Fix this problem! // to show up during compiles. Note that you can NOT use the … Read more
You can use (on VIM at least): :set invnumber More Info: :set number Turn line numbers on :set nonumber Turn line numbers off :set invnumber Toggle line numbers :set number! Toggle line numbers :set number& Set option to default value :set number? Show value of option source: http://vim.wikia.com/wiki/Managing_set_options#Boolean_options
The idea back then was that you could easily add code everywhere in your program by using the appropriate line number. That’s why everybody uses line numbers 10, 20, 30.. so there is room left: 10 PRINT “HOME” 20 PRINT “SWEET” 30 GOTO 10 25 PRINT “HOME” On the first interfaces BASIC was available for, … Read more
M-g g or M-g M-g are the default bindings for goto-line. And, the easiest way to find this is either M-x where-is RET goto-line RET which will list the bindings for the command goto-line, or you can type C-h b which lists all the bindings for the current buffer (and then you can peruse the … Read more
The function inspect.stack() returns a list of frame records, starting with the caller and moving out, which you can use to get the information you want: from inspect import getframeinfo, stack def debuginfo(message): caller = getframeinfo(stack()[1][0]) print(“%s:%d – %s” % (caller.filename, caller.lineno, message)) # python3 syntax print def grr(arg): debuginfo(arg) # <– stack()[1][0] for this … Read more
With :%s/^/\=line(‘.’)/ EDIT: to sum up the comments. This command can be tweaked as much as you want. Let’s say you want to add numbers in front of lines from a visual selection (V + move), and you want the numbering to start at 42. :'<,’>s/^/\=(line(‘.’)-line(“‘<“)+42)/ If you want to add a string between the … Read more