vim-scripts / preservenoeol Goto Github PK
View Code? Open in Web Editor NEWPreserve missing EOL at the end of text files.
Home Page: http://www.vim.org/scripts/script.php?script_id=4550
Preserve missing EOL at the end of text files.
Home Page: http://www.vim.org/scripts/script.php?script_id=4550
This is a mirror of http://www.vim.org/scripts/script.php?script_id=4550 DESCRIPTION This plugin causes Vim to omit the final newline (<EOL>) at the end of a text file when you save it, if it was missing when the file was read. If the file was read with <EOL> at the end, it will be saved with one. If it was read without one, it will be saved without one. Some (arguably broken) Windows applications (also several text editors) create files without a final <EOL>, so if you have to interoperate with those, or want to keep your commits to revision control clean of those changes, this plugin is for you. This works for all three line ending styles which Vim recognizes: DOS (Windows), Unix, and traditional Mac. Multiple strategies are implemented to handle these cases, so you can choose the one that fits you best. HOW IT WORKS Except for the internal Vimscript implementation, all other strategies first let Vim save the file as usual (with a final <EOL>), and then post-process (on BufWritePost) the file contents, using file-system API functions to truncate the final <EOL>. RELATED WORKS The pure Vimscript implementation is based on the following VimTip: http://vim.wikia.com/wiki/Preserve_missing_end-of-line_at_end_of_text_files USAGE If you always want to preserve a misssing <EOL> in text files, just put :let g:PreserveNoEOL = 1 into your vimrc and you're done. If you need more fine-grained control or want to just turn this on in particular situations, you can use the following commands or the buffer-local flag b:PreserveNoEOL. :PreserveNoEOL For the current buffer, the 'noeol' setting will be preserved on writes. (Normally, Vim only does this for 'binary' files.) This has the same effect as setting the marker buffer variable: let b:PreserveNoEOL = 1 :SetNoEOL When writing the current buffer, do not append an <EOL> at the end of the last line, even when there used to be one. Same as setlocal noeol | let b:PreserveNoEOL = 1
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.