Comments (13)
I can't reproduce it yet.
The original formatted source code is this?
In my environment, the space is not appended. Please let me know your Vim and Crystal version.
from vim-crystal.
@will
This is log on my desktop. Could you try it in your environment if you can?
~/Dev/github.com/manastech/crystal % cat pg.cr
require "./core_ext/*"
require "./pg/*"
module PG
def self.connect(conninfo)
conn = Connection.new(conninfo)
conn.exec("SET extra_float_digits = 3")
conn
end
end
~/Dev/github.com/manastech/crystal % cat pg.cr | crystal tool format -
require "./core_ext/*"
require "./pg/*"
module PG
def self.connect(conninfo)
conn = Connection.new(conninfo)
conn.exec("SET extra_float_digits = 3")
conn
end
end
I want to be sure that this is vim-crystal's bug.
from vim-crystal.
vim-crystal formatting process is
- Get whole buffer and format it with
crystal tool format
. The result is preserved tog
register. - Delete current buffer with
gg"_G
- Put the
g
register content by"gp
.
I think 3. behavior may depend on some options and I've not noticed that yet.
from vim-crystal.
Yes that file
I'm using neovim,
~ ➤ vim --version
NVIM 0.0.0-alpha+201508051908 (compiled Aug 6 2015 21:31:10)
Commit: 5a195858657e1c494e77ea868073d2f3664cdb60
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -O2 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim20150806-83927-pht89k/build/config -I/tmp/neovim20150806-83927-pht89k/src -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include/luajit-2.0 -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/tmp/neovim20150806-83927-pht89k/deps-build/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim20150806-83927-pht89k/build/src/nvim/auto -I/tmp/neovim20150806-83927-pht89k/build/include
Compiled by will@skadi
Optional features included (+) or not (-): +acl +iconv +jemalloc
For differences from Vim, see :help vim-differences
system vimrc file: "$VIM/nvimrc"
user vimrc file: "~/.nvimrc"
2nd user vimrc file: "~/.nvim/nvimrc"
user exrc file: "~/.exrc"
fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD/share/nvim"
but also regular (not neo) vim has the same issue
test ➤ /usr/local/Cellar/vim/7.4.826/bin/vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 3 2015 06:56:16)
MacOS X (unix) version
Included patches: 1-826
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent -gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
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 -F/usr/local/Frameworks -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/Users/will/.rbenv/versions/2.2.0/lib -fstack-protector -L/usr/local/lib -F/usr/local/Frameworks -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 -F/usr/local/Cellar/python/2.7.10_2/Frameworks -framework Python -lruby-static -framework CoreFoundation -lobjc -L/Users/will/.rbenv/versions/2.2.0/lib
The log you asked for is the same
test ➤ cat pg.cr
require "./core_ext/*"
require "./pg/*"
module PG
def self.connect(conninfo)
conn = Connection.new(conninfo)
conn.exec("SET extra_float_digits = 3")
conn
end
end
test ➤ cat pg.cr | crystal tool format -
require "./core_ext/*"
require "./pg/*"
module PG
def self.connect(conninfo)
conn = Connection.new(conninfo)
conn.exec("SET extra_float_digits = 3")
conn
end
end
test ➤ diff <(cat pg.cr) <(cat pg.cr | crystal tool format -)
test ➤
Maybe it's something in my rc file? https://github.com/will/dotfiles/blob/master/vimrc
from vim-crystal.
Thakn you for the information. I think I can try again.
from vim-crystal.
I found that set virtualedit=all
causes this problem. I'll fix it.
from vim-crystal.
I fixed the bug. Please update this plugin and confirm the bug is fixed in your environment.
from vim-crystal.
Almost! The first space is gone, but there is still an extra newline at the end
diff --git i/src/pg.cr w/src/pg.cr
index b4a8352..cd2fb6a 100644
--- i/src/pg.cr
+++ w/src/pg.cr
@@ -8,3 +8,4 @@ module PG
conn
end
end
+
from vim-crystal.
That's right :(
from vim-crystal.
Actually the newline is derived from Vim's odd behavior on empty buffer. POSIX defines that text file must be ended with newline. So, when buffer is empty, Vim adds newline to buffer and it remains after putting the formatted code.
from vim-crystal.
I fixed again!
from vim-crystal.
Just tried it out. Works great, thank you!
from vim-crystal.
from vim-crystal.
Related Issues (20)
- Shorthand null checking indents an extra unit HOT 6
- Latest commit throws error on ECR files HOT 3
- ECR files break formatting entirely until vim restart HOT 2
- Add highlighting for variables HOT 4
- Option to write buffer before executing spec HOT 4
- have you looked into tree-sitter yet? HOT 2
- vim-crystal commands do not work HOT 8
- Create releases
- select not indended, should be handled like case HOT 1
- abstract def method prevents matchit to function properly
- Don't always require all specs
- Setting the compiler command to `bin/crystal` breaks the code on `:CrystalFormat` HOT 8
- Faulty syntax highlighting for numbers HOT 9
- [feature request] Comment block editing mode HOT 4
- Auto format should not block saving buffer HOT 3
- Syntax: regression in highlighting 'end' HOT 1
- macro 'end' highlighting regression HOT 1
- Regression in highlighting until...end HOT 1
- Invalid argument: crystalExceptional HOT 3
- Move to organization HOT 5
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-crystal.