我尝试了很多东西,但我还是没有设法在我的Mac上运行。这是vim --version | grep clip
给出的内容:
+clipboard +job +path_extra -toolbar
+ex_extra -mouse_gpm -sun_workshop +xterm_clipboard
.vimrc
:
➜ ~ cat .vimrc
set number
syntax on
set clipboard=unnamedplus
" indentation settings from https://stackoverflow.com/a/234578/1539208
filetype plugin indent on
" show existing tab with 2 spaces width
set tabstop=2
" when indenting with '>', use 2 spaces width
set shiftwidth=2
" On pressing tab, insert 2 spaces
set expandtab
我也没试过set clipboard=unnamed
。我想要完成的(我在Ubuntu机器上工作)是键入"+y
将复制所选文本(使用可视模式选择),以便我可以将其粘贴到另一个程序中。这不起作用。 "*y
也无效。我的意思是“不工作”,当我在另一个程序中按cmd+v
(比如说Chrome地址栏)时,我应该插入我标记和抽出的文字,但事实并非如此。
我正在运行macOS Sierra 10.12.6。我安装vim版本所做的是brew install vim --with-client-server --with-override-system-vim
。如果这对我有帮助的话,我会更愿意使用另一个vim版本。如果重要的话,我正在使用tmux v2.5。
编辑:我已经尝试过这个Stackoverflow问题中建议的解决方案而没有运气:Clipboard failure in tmux + vim after upgrading to MacOS Sierra。在发布这个问题之前我已经做过了,但出于某种原因,我的大脑认为信息不相关 - 对不起!这是cat .tmux.conf
:
# Disable automatic renaming of windows when commands are executed
set-option -g allow-rename off
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Fix copying (on mac). Ref https://github.com/tmux/tmux/issues/543
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'