For code readability it is common to skip a line every now and then (between functions, variable declarations and so on). May be it is nice to have an option in Line operations to leave those lines.
Easiest way to do this would be to provide a new option which does exactly the same as "Remove empty lines" with the following exception. If there are "n" blank lines together, only delete "n-1" of them.
I think that adding a "Remove n-1 empty lines" to LineOperations is great idea.
However, there are some concerns: - Implementing this function should be simple enough, but I feel like this kind of plugin can quickly get out of hand with unused functions. Are there enough people who would use this function?
- This is stepping over the line into the land of 'code styling'. - This plugin is not really intended to format code (that stuff gets crazy real quick)
If you are looking for a quickly solution try this: 1. In find and replace (ctrl-h) check: "Use reuglar expressions", "Use multi-line matching", "Case sensitive" 2. Search for: "\n{3,}" (or "(\r\n){3,}" in windows) 3. Replace with: "\n\n" (or "\r\n\r\n" in windows)
If you are looking for a more complex solution try [AStyle](http://astyle.sourceforge.net/).
If you can convince me that my concnerns above are not a problem, then I would be more than happy to add this function. Please let me know what you think after reading this.
I agree. I raised this issue before I knew about AStyle or [ClangFormat](http://clang.llvm.org/docs/ClangFormat.html). I also came across this [plugin](https://github.com/codebrainz/code-format) for Geany. So, if Geany devs think that this is an unnecessary function, please feel free to close this issue.
Closed #498.
github-comments@lists.geany.org