bogado / file-line Goto Github PK
View Code? Open in Web Editor NEWPlugin for vim to enabling opening a file in a given line
Home Page: http://www.vim.org/scripts/script.php?script_id=2184
Plugin for vim to enabling opening a file in a given line
Home Page: http://www.vim.org/scripts/script.php?script_id=2184
For example:
$ vim a.h:2876 b.h:6051 c.h:6356 c.h:5356 f.cs:3183 g.h:6373 ...
following warning generated:
"a.h:2876" [New File]
Error detected while processing function <SNR>6_gotoline:
line 24:
"b.h:6051" [New File]
E218: autocommand nesting too deep
E218: autocommand nesting too deep
line 26:
E218: autocommand nesting too deep
"c.h" [readonly][dos] 6356L, 374173C
E218: autocommand nesting too deep
"c.h" [readonly][dos] 6356L, 374173C
Error detected while processing function <SNR>5_FTheader:
line 12:
"f.cs" [readonly][dos] 3183L, 195918C
Error detected while processing FileType Auto commands for "*":
"g.h" [readonly][dos] 6373L, 212368C
Press ENTER or type command to continue
This one: http://www.vim.org/scripts/script.php?script_id=521
The autocmd! is the problem, you are clearing the autocmd from MRU. I'm working around it removing the "!" so the autocomands are not cleared. But I'm sure there is a better solution!
When file-line plugin is included, I get the 'Press ENTER... to continue' messages when opening multiple files. Without file-line, I do not get the prompts.
When opening multiple files at once like vim file1.py file2.py
, only file1.py
will have syntax highlighting enabled. For file2.py
, no :set syntax
is available and I have to set it manually.
I install files with Vundle, so here's my Plugin list, maybe this helps:
Plugin 'flazz/vim-colorschemes'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/YouCompleteMe'
Plugin 'evanmiller/nginx-vim-syntax'
Plugin 'othree/html5.vim'
Plugin 'othree/javascript-libraries-syntax.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'rdolgushin/gitignore.vim'
Plugin 'gregsexton/MatchTag'
Plugin 'justinmk/vim-syntax-extra'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'bogado/file-line'
touch with\ spaces
vim with\ spaces:0
The following error shows up:
Error detected while processing function <SNR>17_gotoline:
line 25:
E172: Only one file name allowed: keepalt edit with spaces
And the file is not opened.
Vim opens the file with spaces
and jumps to the given position.
vim: 7.3 Included patches: 1-1070
file-line: 06d6c0e
The Mentor/Siemens Questa logic simulator produces file paths in transcripts as follows:
():
Can the regexpressions
regex be modified to successfully detect this pattern?
Commit 'bcada' breaks NERDTree in the following case:
when run Vim with a directory as an argument, such as
vim some_dir
NERDTree doesn't became active as it should (NERDTreeHijackNetrw is on).
Also I found next bug:
With vim-startify plugin and no NERDTree, neither Netrw nor file:line don't work. Probably this one is connected to startify, but the strange thing is that with both plugins: startify and NERDTree, and the commit reverted everything works.
Awesome, I wanted this for long. Is it possible to also support that for the :e command ? Just give me some pointers and I'll send you a pull request
(Also opened, and promptly closed, at tpope/vim-fugitive#602)
I've created a minimal reproducing repo here: https://github.com/pbrisbin/fugitive-bug, the following should show the bug:
git clone https://github.com/pbrisbin/fugitive-bug && cd fugitive-bug
vim -u vimrc foo.md +5
:GDiff
etc work as expectedvim -u vimrc foo.md:5
:GDiff
etc are not definedI’ve been wondering how I can get around the awkward netrw URL notation:
vim scp://host.domain.com//home/user/.bashrc
Do you think, when you encounter a colon and it’s not followed by a number, or it’s the final character, you could check if it looks like an SSH host:file notation and then rewrite it into the above notation
vim host.domain.com:/home/user/.bashrc
or
vim host.lan:.bashrc
I could imagine checking .ssh/config for Host entries could work. Perhaps there’s an existing unrelated plugin, but I can’t find anything.
When I open vim via vim .
I get the following.
"." is a directory
"." is a directory
Press ENTER or type command to continue
Any ideas?
I'm using NVIM v0.4.3 with this plugin. I noticed that when opening a file to a line number it opens in buffer 2 rather than buffer 1. For example:
nvim foo.txt # Opens in buffer 1, run :ls to see
nvim foo.txt:1 # Opens in buffer 2, run :ls to see
This isn't really a problem, but it's strange so I'm reporting it. Is there any way to fix this?
Probably closely related to #63
Here is a minimal .vimrc to reproduce :
set nocompatible
syntax enable
set hidden
call plug#begin()
Plug 'ydeweerdt/file-line'
call plug#end()
Then open two existing files, with vim foo.js bar.js
run :bn
to switch to the next buffer, the syntax highlighting is not applied.
I tried to apply #66 but it doesn't fix it.
I have next line in my .vimrc
:
au BufNewFile main.c silent! 0r ~/.vim/skeleton/template.%:e
This loads content from template file when I'm creating new main.c
file.
But when file-line
plugin is installed -- this functionality doesn't work (newly created main.c
is blank).
Is it possible to jump to a file:line_number if it was writer inside vim itself. Like for example, from a stack trace in the vim terminal, or if I write PageBase:75 inside a document, the gf
or gF
command moves me to the desired line number in the file?
I tried using this: https://github.com/wsdjeg/vim-fetch but it isn't working for me (The plugin is crashing)
The file-line
plugin breaks shell redirection: the command below should start vim
with a buffer containing its manpage, but instead vim
shows an empty buffer with a name like "/proc/65432/fd/63".
vim <(man vim)
The plugin breaks it because it tries to re-read the buffer, which is not possible from a pipe. You can fix the example above like this, though it would be better to do a more general check for pipes (and other special files) because they can also only be read once.
90c90
< if match(expand("%:p"), "^/proc/.*/fd/.*$") < 0 && match(expand("%:p"), "^/dev/fd/.*$") < 0 && !isdirectory(expand("%:p"))
---
> if !isdirectory(expand("%:p"))
If I launch vim from zsh with the following command vim 2015.md
, the plugin causes a new file to be made but with the name "0" and not "2015.md".
not really an issue, but just wanted to say file-line is awesome. just what i was looking for :)
Dieter
$ vi a.txt:10 a.txt:36
I'm expecting it to open two "files", I can then use :n
and :prev
to navigate between them.
With old version it is working exactly as I expected, but in new version, the cursor only stays at the last position.
Not sure why this is happening, but I'm pretty sure this plugin breaks the v:swapchoice
varaible.
I have a section of code in my vimrc like:
augroup NoSimultaneousEdits
autocmd!
autocmd SwapExists * let v:swapchoice = 'o'
augroup END
Here's some online explanation.
It looks like vim (and nvim) no longer respect the swapchoice setting when this plugin is loaded. It works for 'q'
and 'a'
(I didn't try others), but not 'o'
(probably the most common choice). Any idea what's going on here?
After vim file1 file2
second file opens without syntax highlighting.
Please disable these debug messages:
echomsg "Found " . a:file_name . " - " . a:line_num . " - " . a:col_num
echomsg "regexp = " . regexp
echomsg "file = " . file
When using the following command:
% vim -p foo:10 bar:20
Only foo
is opened.
I suggest changing the colon to a dash or underscore.
See https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
These two commands have the same effect:
$ vim README.md plugin/file_line.vim:10 -o
$ vim README.md plugin/file_line.vim:10
And those two also have the same effect:
$ vim README.md:10 plugin/file_line.vim:10 -o
$ vim README.md:10 plugin/file_line.vim:10
This work as expected :
$ vim README.md:10 plugin/file_line.vim -o
and this has no syntax highlight on the second file
$ vim README.md:10 plugin/file_line.vim
Unknown recent changes cause Vim to be unable to inspect tarfiles.
Running vim -d file1 file2
opens vim with buffers for both file1 and file2, but it sets both windows to the same file1 buffer.
When I use this plugin, it causes Vim to treat jar files as tar files.
:verbose set ft?
filetype=tar
Last set from /usr/share/vim/vim74/autoload/zip.vim
But if I remove this plugin, Vim correctly opens jar files.
Somehow calling bufdo breaks vim -d, but removing the line breaks file-line (see #19). I've no idea how to get around that.
When opening a file, that is already opened with another instance of (neo-)vim, you usually see this error message:
E325: ATTENTION
Found a swap file by the name ...
Then you have the choices:
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
When you choose [O]pen Read-Only
or (R)ecover
, you see this error message:
Error detected while processing function <SNR>71_startup:
line 7:
...which seems to belong to the exec
call in s:startup
function:
file-line/plugin/file_line.vim
Lines 76 to 88 in 559088a
I have no glue, what the function does, but (argidx+1).'argument'
seems to be 1argument
at this point.
I am used to executing vim -p to open all files in tabs.
If the first file is given a line number, vim -p does not open the files in tabs.
I tried removing the :bwipe, and that gives me the expected behaviour (sans the outout of :ls)
First of all thank you for your work!
It'd be great to invoke the plugin for "gf" action as "e" does (#1). It'd be more than useful for coredump analise for example.
Thank you!
I would be really nice if e: filename:linenumber
worked as well! Do you guys know how I would be able to get that to work?
I’m filing this issue both here and for jamessan/vim-gnupg.
When both plugins are active the gnupg plugin stops working and displays a scrambled buffer for encrypted .gpg
files.
In my list of bundles I bisected all plugins until I determined that when file-line is disabled, the gnupg decoding works again.
Thank you for the plugin! I am loving it, it is very useful for pasting error messages from the console.
I have run into one issue. Finally got around to reducing it to a simple case...
Replication:
one.txt
and two.txt
with a few lines in each$ mvim one.txt
:sp two.txt:2
Behavior:
one.txt
from view and puts two.txt
in its placeExpected behavior:
two.txt
in a new split and keep one.txt
openNotes:
:buffers
shows both files, so I think it is not closing the buffer but removing it from view (I don't have a fantastic understanding of the relation of buffer and view, or I could elaborate more. :| )one.txt
and two.txt
open, and try :sp two.txt:3
, it correctly opens the split at the right place and does not close the others (three viewports open total)If file contains tab character in the beginning, followed by some other character, like:
[tab]ABC
then file-line doesn't work, i.e. if you are trying to do:
$ vim Documentation/crypto/async-tx-api.txt:203
it doesn't work.
The example of such file is here.
The filetype is for some reason not set on the second file if I open multiple files (of the same filetype). The problem only occurs with set hidden
. Consider the following minimal working example:
set nocompatible
let &rtp = '~/.vim/bundle/file-line/,' . &rtp
filetype plugin indent on
syntax enable
set hidden
program test1
implicit none
!
print *, "This is test1"
end program test1
program test2
implicit none
!
print *, "This is test2"
end program test2
Now do gvim -u minivimrc *.f90
(or vim
) followed by :bnext<cr>
. This will go to the next file, which does not have any syntax highlighting because the filetype is not set.
This issue is similar to #28 and #29, which were closed as fixed in #34. However, the above procedure clearly shows that the current issue exists and is reproducible.
Edit: Minor update.
When I grep for some source, I might get output like this:
arch/arm/include/asm/fiq.h:37:extern void release_fiq(struct fiq_handler *f);
arch/arm/include/asm/fiq.h:38:extern void set_fiq_handler(void *start, unsigned int length);
arch/arm/include/asm/fiq.h:39:extern void enable_fiq(int fiq);
Double clicking will give me the extra "extern" (or some other text) after the : where file_line expects a column number.
I've tried to decypher the matchlist expression, but I cannot work out how to make it pass when "garbage" is passed instead of a column number.
Also keep in mind, at least in C, some of the lines might also have things like # in them:
arch/arm/include/asm/tlbflush.h:13:#ifdef CONFIG_MMU
Is it possible to parse this and discard the garbage?
In my configuration the new startup sequence is somehow unloading fugitive if the reopenAndGotoFile is invoked.
reproduce steps :
$ cd <path_to_file_line>
$ vim plugin/file_line.vim:
check that :Gblame is not defined.
With a recent version of netrw installed, this plugin causes multiple buffers to be opened when using a command e.g.
vim scp://some.validhost.com//path/to/file.txt
which opens a blank buffer with name "scp
" as the first buffer, and the expected netrw buffer editing "/path/to/file.txt
" on remote host some.validhost.com
as the second buffer.
I assume any version combination of netrw/file-line manifests this issue, but for reference I am using version v153 of netrw, and SHA a1381d0 for file-line.
When opening multiple files, the first file is not syntax highlighted. This is probably because the FileType autocommands are omitted in bufdo.
The same issue ( #61 ) was closed by mistake, so creating new one (duplicate).
I have next line in my .vimrc
:
au BufNewFile main.c silent! 0r ~/.vim/skeleton/template.c
This loads content from template file when I'm creating new main.c
file.
But when file-line
plugin is installed -- this functionality doesn't work (newly created main.c
is blank).
More detailed description is here: #60 (comment)
vim-linux-coding-style plugin automatically highlights data types like u8
, __u8
etc. But file-line
plugin breaks that highlighting.
Next workaround fixes it for me:
@@ -79,10 +79,6 @@ function! s:startup()
if argc() > 0
let argidx=argidx()
- silent argdo call s:handle_arg()
- exec (argidx+1).'argument'
- " Manually call Syntax autocommands, ignored by `:argdo`.
- doautocmd Syntax
endif
endfunction
But more elegant solution should be found, I guess (because I believe that the code I removed was added for a reason).
if you try to open 2 or more files with line numbers the window wont be split. eg
vim -O file1.txt file2.txt:33
this opens both files but no split and only file1.txt is visible. Note that switching to file2.txt the cursor is on the correct line. Also if not line numbers are specified everything works OK.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.