dex icon indicating copy to clipboard operation
dex copied to clipboard

Add command-line option to go to a specific line on startup

Open parras opened this issue 8 years ago • 6 comments

E.g.: $ dex +245 myfile will open myfile with the cursor positioned on line 245. This ensures compatibility with less.

parras avatar Apr 29 '16 14:04 parras

For single files, you can already use:

dex -c 'line 245' myfile

For multiple files you can use:

dex -c 'open file1; line 245; open file2; line 120'

Does this new flag handle opening multiple files or just the first?

craigbarnes avatar Jul 22 '17 00:07 craigbarnes

@craigbarnes, yes it is equivalent but note that:

  1. the + syntax is a convenient shorthand
  2. it ensures compatibility with less's v command:

Invokes an editor to edit the current file being viewed.

parras avatar Jul 26 '17 12:07 parras

I don't see this interfering with anything, especially since dte honours the -- flag in case you want to edit a file that starts with a +. The option of dex being set as less' editor is a nice feature.

pepa65 avatar Jul 26 '17 12:07 pepa65

Only the first, which is consistent with the behavior of vim, nano and less.

I can't seem to make this option work at all with less (even with a single file) but nano seems to support using it for multiple files:

nano +500 src/edit.c +20 GNUmakefile +160 Documentation/dte.txt

I intend to implement this at some point in the dte fork (issue: dte-editor/dte#16).

craigbarnes avatar Jul 26 '17 17:07 craigbarnes

Strange that less shouldn't work for you... Here it works, only for the first file, and nano indeed works with more than one.

pepa65 avatar Jul 26 '17 17:07 pepa65

This is implemented in the dte fork now, in commit 22138515.

craigbarnes avatar Jul 30 '17 08:07 craigbarnes