#43351 closed defect (fixed)
tmux @1.9a; wrong file is copied to vim's ftdetect, breaking vim syntax
Reported by: | vergus@… | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | haspatch | Cc: | tessus (Helmut K. C. Tessarek) |
Port: | tmux |
Description
The wrong file is being written to /opt/local/share/vim/vimfiles/ftdetect/tmux.vim . What is currently being written is a copy of the syntax file located at: /opt/local/share/vim/vimfiles/syntax/tmux.vim. What should be writtent to that file is:
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
As it is, this breaks syntax for EVERY file that does not have a filetype (e.g. anything without an extension- README, etc.).
Change History (23)
comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | tessarek@… ryandesign@… added |
---|
comment:2 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
I only updated the tmux version. The post-destroot is basically the same as before. I just changed the line
xinstall -m 0644 ${filespath}/tmux.vim ${destroot}${prefix}/share/vim/vimfiles/ftdetect
because it resulted in an error.
comment:5 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
During destroot? I can't reproduce that. The directory being copied into is created a few lines up, and the file being copied is right there in the files directory (or was, until I removed it in r118742 because it was no longer being used). Shall I change it back to the way it was before? Or to vergus' new version?
comment:6 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
I'm a little bit confused.
2 lines up, the file tmux.vim is copied from ./examples/tmux.vim into the syntax directory:
xinstall -m 0755 -d ${destroot}${prefix}/share/vim/vimfiles/syntax xinstall -m 0644 ${worksrcpath}/examples/tmux.vim ${destroot}${prefix}/share/vim/vimfiles/syntax
So the file is never copied to ${filespath}
, so how can the file be there? Maybe I'm missing something here, but the tmux.vim file is a syntax file. So something is off. Or is there another file on the server that has the same name, but a different content? As I said, I'm confused.
comment:7 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Yes, there are two different files named tmux.vim. One is in the source distribution in the examples directory and gets copied to /opt/local/share/vim/vimfiles/syntax/tmux.vim. The other is (was) in the files directory and gets (got) copied to /opt/local/share/vim/vimfiles/ftdetect/tmux.vim (until your change). Do you not have this files directory on your system, in the same directory where you have the tmux Portfile? If not, why not?
comment:8 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
This is strange. I only had 3 files in my directory: tmux.1.diff, tmux.h.diff, osdep-darwin.c.diff
. These patches were unnecessary with 1.9a and therefore I removed them.
Maybe there was a glitch in svn when I checkout the Port. In any case it seems that this was my fault.
Can you please restore the previous file tmux.vim
into a new file called 'tmux.ftdetect` and change the line to:
xinstall -m 0644 ${filespath}/tmux.ftdetect ${destroot}${prefix}/share/vim/vimfiles/ftdetect
If the OP prefers autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
, please change the content as well.
I'm sorry to put this on you. I'd do it myseslf, but I don't have commit privilege.
comment:9 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
The filename extension is immaterial?
I'll wait to hear back from the OP regarding which version of the file we should use, since I don't know tmux and don't know what effect any of these directives have.
comment:10 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
Argh. Of course you are right. (*Too many shells open and too much cut and paste*) Yes, it should be:
xinstall -m 0644 ${filespath}/tmux.ftdetect ${destroot}${prefix}/share/vim/vimfiles/ftdetect/tmux.vim
I don't like it, if an ambiguous file is located in a 'root' dir, because you can't know just by looking at the file, if it's a syntax or a ftdetect file.
We can solve this by either creating a directory ftdetect
and write:
xinstall -m 0644 ${filespath}/ftdetect/tmux.vim ${destroot}${prefix}/share/vim/vimfiles/ftdetect
or by naming the file differently and write:
xinstall -m 0644 ${filespath}/tmux.ftdetect ${destroot}${prefix}/share/vim/vimfiles/ftdetect/tmux.vim
comment:11 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
Additional info: the 2 files in question are not tmux files. They are vim files for tmux. The one is the syntax file that allows vim to highlight tmux commands. The other file just tells vim, which files are tmux files and which syntax file vim should use for highlighting.
comment:12 follow-up: 14 Changed 11 years ago by vergus@…
tmux.ftdetect is plain wrong. And a ftdect file at the root level is bad, either because vim won't use it (haven't tested), or something else will want to write there. It should be /opt/local/share/vim/vimfiles/ftdetect/tmux.vim See http://vimdoc.sourceforge.net/htmldoc/filetype.html#ftdetect
But maybe the files should just be deleted. They are not essential to tmux and are provided in tmux's example directory. Vim users can install separately from https://github.com/tejr/vim-tmux if they really want it.
comment:13 follow-up: 16 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
@vergus:
You misunderstood. We were talking about where to put (or how to name) the file in the Port source tree. You are talking about the target location. And yes, it will be in /opt/local/share/vim/vimfiles/ftdetect/tmux.vim
.
We just need to know, if you rather like the content of the ftdetect file tmux.vim to be:
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
or
autocmd BufRead,BufNewFile .tmux.conf setf tmux
comment:14 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to vergus@…:
But maybe the files should just be deleted. They are not essential to tmux and are provided in tmux's example directory. Vim users can install separately from https://github.com/tejr/vim-tmux if they really want it.
Installing the files with the port seems useful. Is there any detriment to doing so? If not, we should continue to do so.
comment:15 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
I agree, we should install these 2 files with tmux. There is no harm in doing so.
comment:16 Changed 11 years ago by vergus@…
Replying to tessarek@…:
We just need to know, if you rather like the content of the ftdetect file tmux.vim to be:
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
I vote for this one since it doesn't limit itself to a single tmux conf file. It will accept tmux.conf, .tmux.conf, tmux.conf.osx, osx.tmux.conf, etc.
comment:17 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
I agree.
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
matches all files that include the string tmux.conf
.
@ryan: can you please make the necessary changes? You can also give me commit right to the tmux repository and I make the changes myself.
comment:18 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
Additional info: I'm willing to maintain this port.
comment:20 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… removed |
---|---|
Keywords: | haspatch added |
Owner: | changed from macports-tickets@… to ryandesign@… |
Status: | new → assigned |
I'll address it today.
comment:21 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
tessarek, I've committed the fix in r119136, and I've made you the maintainer.
I appreciate your enthusiasm about MacPorts, but since this is the first port you will be maintaining, commit access to the MacPorts repository would be premature. See the guide for more information on the prerequisites for commit access. For now, please file tickets and attach patches for any changes you'd like made to the port.
comment:23 Changed 11 years ago by tessus (Helmut K. C. Tessarek)
I didn't know that the commit access would be for the entire repo. I'm used to a much stricter access control. If that were the case, you could give me access to just a directory or even a file.
Replying to vergus@…:
This change was made in r118741, as requested and provided as part of #43309. I'm Cc'ing the provider of that patch for comment.
What we had in the file before was:
We can go back to that, or to your version, if we need to. I don't know tmux so I don't know what's appropriate.