Why does 3dd not work from the last line in vim? - vim

If I do 3dd with the cursor at the next-to-last line in a file, two lines are deleted, as expected. If I do the same with the cursor at the last line, I'd expect one line to get deleted, but that does not happen. Why the discrepancy?
Starting file:
line 1
line 2
line 3 █
After 3dd:
line 1
line 2
line 3 █
After k3dd:
line 1 █

I'd say bug, since dd will delete that line ...
Edit: and yes, I can reproduce that behavior with any other number in front of dd as well ...
Edit2: except 1dd, this works as expected. To me that's a bug ...
My vim
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 5 2012 10:17:30)
Included patches: 1-411
Modified by <bugzilla#redhat.com>
Compiled by <bugzilla#redhat.com>
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm
-mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl +postscript
+printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"

Related

How to add python3 support to MacVim?

I recently installed MacVim (not through brew), and as I was trying to set up some basic configurations, I encountered an issue with python3 and the UltiSnips plugin. My vimrc is currently just a very basic one that I downloaded from vim bootstrap, and every time I try to edit something in insert mode, I get the following error:
Error detected while processing /Users/name/.vim/plugged/ultisnips/autoload/UltiSnips.vim`: line 7: E319: Sorry, the command is not available in this version: py3 import vim
The :version command is telling me that I am not on the "small version" of macvim, but it is saying that I don't have the python3 feature. How can I add this feature?
The output of :version after redownloading MacVim is
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +clientserver +diff +folding +lambda +mouseshape +netbeans_intg +python3/dyn +statusline +textprop +vreplace
+arabic +clipboard +digraphs -footer +langmap +mouse_dec +num64 +quickfix -sun_workshop +timers +wildignore
+autocmd +cmdline_compl +dnd +fork() +libcall -mouse_gpm +odbeditor +reltime +syntax +title +wildmenu
+autochdir +cmdline_hist -ebcdic +fullscreen +linebreak -mouse_jsbterm +packages +rightleft +tag_binary +toolbar +windows
-autoservername +cmdline_info +emacs_tags +gettext +lispindent +mouse_netterm +path_extra +ruby/dyn -tag_old_static +transparency +writebackup
+balloon_eval +comments +eval -hangul_input +listcmds +mouse_sgr +perl/dyn +scrollbind -tag_any_white +user_commands -X11
+balloon_eval_term +conceal +ex_extra +iconv +localmap -mouse_sysmouse +persistent_undo +signs -tcl +vartabs -xfontset
+browse +cryptv +extra_search +insert_expand +lua/dyn +mouse_urxvt +popupwin +smartindent +termguicolors +vertsplit +xim
++builtin_terms +cscope -farsi +ipv6 +menu +mouse_xterm +postscript -sodium +terminal +virtualedit -xpm
+byte_offset +cursorbind +file_in_path +job +mksession +multi_byte +printer -sound +terminfo +visual -xsmp
+channel +cursorshape +find_in_path +jumplist +modify_fname +multi_lang +profile +spell +termresponse +visualextra -xterm_clipboard
+cindent +dialog_con_gui +float +keymap +mouse -mzscheme +python/dyn +startuptime +textobjects +viminfo -xterm_save
I am not sure where you got that "MacVim" from, but :version is supposed to report the following in the latest build (9.0.65 (173)):
[...]
+python/dyn
+python3/dyn
[...]
so it looks like you are not using MacVim to begin with. FWIW, you should have the following as well:
+profile
+rightleft
which you don't.
Once you get a proper MacVim, see :help 'pythonthreehome' and :help 'pythonthreedll'.

Eclim autocomplete not working with neocomplete

I am using Eclim and Vim and Neocomplete plugin, but omnifunc does not work for me at all.
It seems that my environment is properly set, because when I try Eclim functions that test its environment then everything seems to be properly configured.
:PingEclim yields these results
eclim 2.5.0
eclipse 4.5.1
:EclimValidate
Result: OK, required settings are valid.
I put this is my ~/.vim/plugin/eclim.vim, which was autogenerated by eclim installer
let g:EclimCompletionMethod = 'omnifunc'
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.java = '\%(\h\w*\|)\)\.\w*'
Filetype seems to be properly edentified, filetype is enabled
:filetype
filetype detection:ON plugin:ON indent:ON
It seems that omnicomplete is properly invoked as I type, for example import org. prints an error
-- Omni completion (^O^N^P) Pattern not found
Also <C-x><C-u> brings
E764: Option 'completefunc' is not set
Vim info follows
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 11 2015 20:44:58)
MacOS X (unix) version
Included patches: 1-936
Compiled by Homebrew
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_binary
+arabic +find_in_path -mouse_sysmouse +tag_old_static
+autocmd +float +mouse_urxvt -tag_any_white
+balloon_eval +folding +mouse_xterm +tcl
+browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +fullscreen -mzscheme +textobjects
+cindent -gettext +netbeans_intg +title
+clientserver -hangul_input +odbeditor +toolbar
+clipboard +iconv +path_extra +transparency
+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_gui +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
+farsi +mouse_netterm +syntax
Any help?

How did cygwin compile vim to enable clipboard support while without gui and x

Following is vim 7.4
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 22 2014 14:31:17)
...
<cygwin#cygwin.com>
+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/dyn +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent +python3/dyn +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con +lua/dyn +rightleft +windows
+diff +menu +ruby/dyn +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
Note that the clipboard support is enabled, which I find is greatly convenient for me to exchange text between windows and the terminal. And in my server with Fedora installed, I just want to compile a vim with the same clipboard support. Is it possible and if it is, how?
Here is some ref that may help.
https://groups.google.com/forum/#!topic/vim_dev/rIFYgTrsys4
https://bugs.launchpad.net/ubuntu/+source/vim/+bug/837882
https://superuser.com/questions/235505/compiling-vim-with-xterm-clipboard-support
http://kowalcj0.wordpress.com/2013/11/19/how-to-compile-and-install-latest-version-of-vim-with-support-for-x11-clipboard-ruby-python-2-3/
Clipboard access is done through totally different APIs in Cygwin and Linux, that's why. The Cygwin port of Vim uses (either Cygwin or Win32; haven't checked in detail) APIs to access the Windows clipboard. Whereas on Unix, clipboard access is only possible when Vim is compiled with support for X (as is widely documented, and you've discovered).
So, just because the strange operating system-hybrid named Cygwin is able to access the (Windows!) clipboard without X, you cannot conclude that the same should be possible on Unix.

How to change Vim from "-xterm_clipboard" to "+xterm_clipboard" in Mac OS X 10.9 Mavericks?

I am new to vim, and I am trying to paste content from other applications. I am running the native vim that comes with the OS X 10.9 Mavericks.
When I run "vim --version" this is the output
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
I understand I need to change "-xterm_clipboard" to "+xterm_clipboard" to be able to paste the content form other sources.
Thank you
Install your own Vim. If you haven't already, setup Homebrew, then:
brew install macvim --override-system-vim
Bonus is that MacVim can run as a native application, i.e. outside the terminal, like gVim on other platforms. It is also compiled with the "huge" featureset, so you have pretty much everything in it that you'd need, unlike the system Vim.
EDIT: Apparently the option name changed; the new syntax should be
brew install macvim --with-override-system-vim
(See brew options macvim for more options.)

Copying from gvim does not work, copying to does

I start by mentioning that I have already read several suggestions about this, including How to make vim paste from (and copy to) system's clipboard?, https://superuser.com/questions/187537/copy-to-system-clipboard-instead-of-vim-buffer, https://askubuntu.com/questions/172265/how-to-use-a-common-clipboard-for-vim-and-unity and http://vim.wikia.com/wiki/Accessing_the_system_clipboard, but I have been unable to find a solution.
So, my problem is that copying to gvim works through the X11 clipboard but I can't get copy from gvim to work, no matter what. I have verified that my version has x11 clipboard support compiled in. Currently I have added the following to .vimrc:
set clipboard=unnamedplus,autoselect
set guioptions+=a
set paste
set go+=a
Simple yanking doesn't work, neither does "+y or "*y. I have verified with xclip that there's nothing in the clipboard. I have tried several other parameter variations as well, including
I'm using Ubuntu 12.04 and gvim --version says
$ VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 4 2012 04:22:36)
Included patches: 1-429
Modified by pkg-vim-maintainers#lists.alioth.debian.org
Compiled by buildd#
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall
+linebreak +lispindent +listcmds +localmap +lua +menu +mksession +modify_fname
+mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm
-mouse_sysmouse +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme
+netbeans_intg +path_extra +perl +persistent_undo +postscript +printer +profile
+python -python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
+toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
+xsmp_interact +xterm_clipboard -xterm_save
So could this be something else? Any ideas? This is driving me craze, nevermind make me feel stupid because I have to open the files in gedit if I need to copy something to e.g. an email.
set guioptions+=a and set go+=a are one and the same: keep the first one and delete the other.
set paste is an abomination that messes with too many other options to be set by default in your ~/.vimrc. Read :help 'paste', delete that line and read :help 'pastetoggle'.
"+y and "*y end up in different clipboards. What command do you use for yanking and how do you paste in other programs? Ctrl+v? Middle-click?

Resources