Comments (4)
You will see the same issue without endwise if you try to create an empty case statement. Not a lot I can do about that.
from vim-endwise.
@tpope No, that's exactly what I'm saying: If I uninstall endwise, I don't get the same behavior. If endwise isn't present, the indentation is correct by default.
Ah, now I see: the issue is an empty case statement. Duh, sorry. In that case, honestly, it seems better for vim-endwise not to do case...esac
in shell scripts. But at least now I get the issue.
from vim-endwise.
A comment from @telemachus I received by email earlier notes that Super Shell Indent was in use and that it fixed the esac
indent problem -- is that still in use even when vim-endwise
is not installed, @telemachus? Perhaps that could explain why the indentation works (for you) without vim-endwise
, when @tpope and I are not able to reproduce that behavior (I just tested again).
from vim-endwise.
@tangledhelix Yes and no. @tpope was right, and I was confused. If you create an empty case...esac
statement, then the indentation is off whether or not I have vim-endwise. This is what I didn't see at first.
case
esac
case "$1" in
foo)
echo hello
;;
esac
But that said, if I add Super Shell Indent, then everything works -- whether or not I have vim-endwise, including empty case
statements.
So I now understand that the real problem is in Vim's indentation file for shell. Having said that, unless that gets fixed, I wonder whether it isn't better to remove case...esac
handling from vim-endwise. Just my two cents.
For what it's worth, a very small edit to the built-in shell indentation seems to fix things:
$ diff old-sh.vim sh.vim
79a80,81
> elseif line =~ '^\s*esac\>' && s:is_case_empty(getline(v:lnum - 1))
> let ind -= s:indent_value('default')
156a159,166
> function! s:is_case_empty(line)
> if a:line =~ '^\s*$' || a:line =~ '^\s*#'
> return s:is_case_empty(getline(v:lnum - 1))
> else
> return a:line =~ '^\s*case\>'
> endif
> endfunction
>
Unfortunately, I'm a complete rookie at Vimscript, so I'm not sure how much to trust this. Essentially though, I'm just testing for an "empty case" by checking if the previous line is case
or empty (and if it's empty retrying with the line before that until we hit a non-empty line).
from vim-endwise.
Related Issues (20)
- Using the word 'end' in a comment in Ruby breaks auto completion
- Ruby class adds extra end HOT 1
- [Request] Trigger when (o)pening new line HOT 2
- Does not autodisable in paste mode in neovim HOT 1
- [Nvim] Adding automaticly an extra comma for C and Cpp files HOT 1
- Update installation docs HOT 1
- Conflic with CoC HOT 7
- False match at in-line block ending pattern for Ruby
- vim-endwise paired with nvim-cmp causes neovim to freeze HOT 1
- Combining with other `<CR>` mappings HOT 4
- Delay on enter press HOT 4
- Mapping no longer works if delimiteMate plugin is installed HOT 1
- Doesn't work with `#if 0` HOT 1
- Enter prints 'EndwiseAppend("\r")' instead of a newline. HOT 3
- Not working in Ruby for latest commit HOT 1
- 'set cpoptions=n' causes vim-endwise producing 'r' symbol instead of new line HOT 7
- Does not work with Treesitter installed HOT 3
- add support for opening code block delimiters too
- Meson support
- Add support for `djangohtml` (1 line change)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-endwise.