Giter Club home page Giter Club logo

tmux.vim's People

Contributors

blueyed avatar dundargoc avatar ericpruitt avatar gartens avatar gpanders avatar polyzen avatar valtermro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tmux.vim's Issues

Plugin not loading by default if installed with plugin manager

Thanks for the handy plugin.
There is a small issue though: by default, if it's installed via plugin manager, it won't be loaded, because the directory structure is like:

tmux.vim
  │
  ...
  └── vim
      ├── ftdetect
      │   └── tmux.vim
      ├── ftplugin
      │   └── tmux.vim
      └── syntax
          └── tmux.vim

A workaround if you use vim-plug is:
Plug 'ericpruitt/tmux.vim', { 'do': 'ln -sf vim/* .' }

Maybe the default directory structure can be changed?

ftplugin/tmux.vim does not define 'comments'

The ftplugin/tmux.vim does not set a value to the option 'comments'.
This means that the user's value is used which can be anything, thus breaking functionality relying on 'comments', e.g. reformatting.

Other ftplugins set this option to a value suitable for their language. For tmux.conf I would recommend something like

setlocal comments=:#

While we are at it. It's a good habit to provide an "undo" functionality, e.g.

let b:undo_ftplugin = "setlocal comments< commentstring<"
setlocal comments=:#
setlocal commentstring=#\ %s

No support for line continuations with backslash

The following snippet is not highlighted correctly:

set-option -g status-right "\
#[fg=black,bg=brightwhite,bold] #H \
"

in particular:

  • The second line is interpreted as a comment although we are in a string
  • The " in the first line is not highlighted as a string
  • The " in the third line is not highlighted as a string

The reason for this is probably that line continuation is not supported. From tmux(1)

     If the last character of a line is \, the line is joined with the follow‐
     ing line (the \ and the newline are completely removed).  This is called
     line continuation and applies both inside and outside quoted strings and
     in comments, but not inside braces.

No clue how to implement that but the c syntax highlighting supports this (It has also a cBadContinuation highlighting in case you accidentially add a space after the backslash).

tmux.conf.local not detected

As I am using the oh-my-tmux configuration from gpakosz/.tmux, my main configuration file is actually .tmux.conf.local. Standard vim configuration (without vim-polyglot) still uses the general conf highlighting here, but with this plugin it does not apply any kind of syntax highlighting at all.

I added this line

autocmd BufNewFile,BufRead {.,}tmux.conf.* setfiletype tmux

to my init.vim and it works for now. I suggest adding it to ftdetect.vim to support all kinds of modded configurations, if the wildcard does not cause any problems.

Support for {}-strings

tmux 3.0 introduces {}-strings. From tmux(1):

     Command arguments may be specified as strings surrounded by single (')
     quotes, double quotes (") or braces ({}).  This is required when the ar‐
     gument contains any special character.  Single and double quoted strings
     cannot span multiple lines except with line continuation.  Braces can
     span multiple lines.

It would be nice to support these in some way, e.g. highlight as string. Or introduce a new highlighting group/colour-flavour for these kinds of strings.

MatchParen highlight is incorrect for () and {} in tmuxFormatString syntax regions

Expected behavior

Normally, when moving the cursor onto the [ ], ( ) or { } characters in vim then the matching bracket/parenthesis/curly brace is also highlighted in a way so we can tell the difference which one is selected and which one is the matching pair based on the different syntax highlighting.

For the [ ] brackets the tmux syntax highlighting is working as expected: the selected and matching brackets has different fg/bg colours:
image

Actual behavior

But for the ( ) or { } characters the tmux syntax highlighting use the same bg and no fg
for both the selected and the matching parenthesis/brace, so it is hard to tell which pair is actually selected and what type of bracket it is:
image

I don't have experience with writing vim syntax highlighters, so I'm not exactly sure what the issue with these lines in the syntax/tmux.vim file, but commenting them out restores the normal selected/matching bracket behavior:

syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ contained keepend
syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend

But of course then we lose the nice syntax highlighting for the variables:
image

Additional info

  • tmux.vim version: 3.0 (git-48cbbb87)
  • vim version: 8.2 (2019 Dec 12, compiled Nov 15 2020 16:46:37), with patches: 1-1989

Restrict spell checking to comments and strings

Currently spellchecking is done everywhere. It might be a good idea to restrict spell checking to actual user content instead to keywords.

Vim seems to support two modes approaches
@spell: do not spellcheck anything unless the corresponding syntax item is marked with @spell
@Nospell: do spellcheck everything but the items marked with @Nospell

For the former approach it seems to be sufficent to add @Spell to the contains field of tmuxComment and tmuxString (or their substitutes from #14) like so

syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell

syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,@Spell
syn region tmuxString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell

command-alias entries are missing from syntax/tmux.vim

As of tmux.git:126d364abe2e8c063efa5a888de69, the command server-info (and its alias info) is now a command-alias for show-messages -JT. Similarly, split-pane, splitp, choose-window, and choose-session are all defined as such:

$ tmux show-options -s command-alias
command-alias[0] split-pane=split-window
command-alias[1] splitp=split-window
command-alias[2] "server-info=show-messages -JT"
command-alias[3] "info=show-messages -JT"
command-alias[4] "choose-window=choose-tree -w"
command-alias[5] "choose-session=choose-tree -s"

It looks as if these entries are defined in options-table.c.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.