1
テキストファイルを保存するときに、VIMに最終行を追加します。奇妙なことに、それを探して、私はこの動作を無効にする方法についての指示しか見つけませんが、私はそれを明示的に求めています。保存時にVIMに最後の改行を追加する
これは私のVIMのインストールです:
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 18 2016 01:00:23)
MacOS X (unix) version
Included patches: 1-1525
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel -gettext -mzscheme +title
+cindent -hangul_input +netbeans_intg -toolbar
-clientserver +iconv +packages +user_commands
+clipboard +insert_expand +path_extra +vertsplit
+cmdline_compl +job +perl +virtualedit
+cmdline_hist +jumplist +persistent_undo +visual
+cmdline_info +keymap +postscript +visualextra
+comments +langmap +printer +viminfo
+conceal +libcall +profile +vreplace
+cryptv +linebreak +python +wildignore
+cscope +lispindent -python3 +wildmenu
+cursorbind +listcmds +quickfix +windows
+cursorshape +localmap +reltime +writebackup
+dialog_con -lua +rightleft -X11
+diff +menu +ruby -xfontset
+digraphs +mksession +scrollbind -xim
-dnd +modify_fname +signs -xsmp
-ebcdic +mouse +smartindent -xterm_clipboard
+emacs_tags -mouseshape +startuptime -xterm_save
+eval +mouse_dec +statusline -xpm
+ex_extra -mouse_gpm -sun_workshop
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names -o vim -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python -lruby.2.0.0 -lobjc
私の.vimrc:romainlを考え出したよう
これはおそらく 'binary'オプションです。設定すると、vimは最後の行に改行を追加しません。 Vimは認識されたファイルタイプに基づいて 'binary'オプションを自動的に設定します。 ':set binary? 'でテストできます。 –
ありがとう、残念ながら 'nobinary' – tyrondis
最後の行の後ろに実際の空行を追加したいのですか、最後の行の最後に改行文字を追加しますか?前者は意味をなさないが、おそらくオートコマンドで行うことができる。 Vimは既定で後者をすでに実行しています。 – romainl