将 .vimrc 移动到一个新的目录中,试图让它工作
Moved .vimrc in a new dir, trying to get it to work
免责声明:我是 vim/tmux 的新手。我在 Mac 使用 MacVim
有人告诉我在我的点文件上使用版本控制。
在我的点文件都放在我的根目录之前~像这样:
~/
.vimrc
.tmux.conf
.vim
/bundle
/autoload
.viminfo
etc
但后来我想创建一个名为 "dotfiles" 的文件夹是个好主意,然后将它们全部存放在那里,然后将其上传到 github,这样我就可以将它们放在任何地方。
像这样:
~/
/dotfiles
.vimrc
.tmux.conf
.vim
/bundle
/autoload
.viminfo
etc
起初我认为一切正常,因为我从来没有关闭 Vim,但是当我稍后重新加载它时,我意识到我的 none 命令不再起作用了。所以我在我的 .vimrc
和 .tmux.conf
中改变了一些路径,希望它能再次工作,但没有运气。
这是我的完整 .vimrc:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/dotfiles/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'christoomey/vim-tmux-navigator'
" " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" " To ignore plugin indent changes, instead use:
" "filetype plugin on
" "
" " Brief help
" " :PluginList - lists configured plugins
" " :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean - confirms removal of unused plugins; append `!` to
" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line
execute pathogen#infect()
syntax on
filetype plugin indent on
set mouse=a
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
nnoremap <silent> <c-/> :TmuxNavigatePrevious<cr>
let g:tmux_navigator_save_on_switch = 1
vnoremap <C-c> "*y
set runtimepath^=~/dotfiles/.vim/bundle/ctrlp.vim
如您所见,路径已更正以包含 /dotfiles/
目录,但每当我尝试 运行 我的 .vimrc 中的插件或其他内容时,我都会得到一个通用的 'Not an editor command'
错误。
顺便说一句,tmux 及其所有配置在四处移动后似乎工作正常。
有什么想法吗?
I was told to use version control on my dotfiles.
也许你应该向那些告诉你这样做的人寻求支持,你不觉得吗?
将所有点文件放在一个存储库中不是必要的,甚至不是一个客观的好主意。它可能对某些人有用,但仅如果你设法将你的程序指向那个集中的地方(很好)或者如果你将这些文件符号链接到他们的常规位置(哪种打败了这一点)。告诉您对点文件使用版本控制的人应该已经告诉您如何从头到尾做到这一点。
Vim 期望您的 vim
目录和 vimrc
位于默认位置:
~/.vim
~/.vimrc or ~/.vim/vimrc
它不会查找其他地方,因此您必须将它们从您的存储库符号链接到它们的预期位置:
$ ln -s /Users/username/dotfiles/.vim /Users/username/.vim
$ ln -s /Users/username/dotfiles/.vimrc /Users/username/.vimrc
将所有点文件放在同一个目录中的想法并不坏,因为@romainl 在他的回答中说你必须将它们符号链接到它们原来的位置。
这就是我所做的,因此您可能对 script I created to automatically save the current dotfiles in my home directory and replace them with a simlink to the dotfiles in my repo. (You can also clone my repo 感兴趣,将点文件替换为您的点文件并执行脚本。我试图让自述文件尽可能清楚,但如果您有兴趣使用我的解决方案,请不要犹豫给我发消息寻求支持)
免责声明:我是 vim/tmux 的新手。我在 Mac 使用 MacVim 有人告诉我在我的点文件上使用版本控制。
在我的点文件都放在我的根目录之前~像这样:
~/
.vimrc
.tmux.conf
.vim
/bundle
/autoload
.viminfo
etc
但后来我想创建一个名为 "dotfiles" 的文件夹是个好主意,然后将它们全部存放在那里,然后将其上传到 github,这样我就可以将它们放在任何地方。
像这样:
~/
/dotfiles
.vimrc
.tmux.conf
.vim
/bundle
/autoload
.viminfo
etc
起初我认为一切正常,因为我从来没有关闭 Vim,但是当我稍后重新加载它时,我意识到我的 none 命令不再起作用了。所以我在我的 .vimrc
和 .tmux.conf
中改变了一些路径,希望它能再次工作,但没有运气。
这是我的完整 .vimrc:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/dotfiles/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'christoomey/vim-tmux-navigator'
" " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" " To ignore plugin indent changes, instead use:
" "filetype plugin on
" "
" " Brief help
" " :PluginList - lists configured plugins
" " :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean - confirms removal of unused plugins; append `!` to
" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line
execute pathogen#infect()
syntax on
filetype plugin indent on
set mouse=a
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
nnoremap <silent> <c-/> :TmuxNavigatePrevious<cr>
let g:tmux_navigator_save_on_switch = 1
vnoremap <C-c> "*y
set runtimepath^=~/dotfiles/.vim/bundle/ctrlp.vim
如您所见,路径已更正以包含 /dotfiles/
目录,但每当我尝试 运行 我的 .vimrc 中的插件或其他内容时,我都会得到一个通用的 'Not an editor command'
错误。
顺便说一句,tmux 及其所有配置在四处移动后似乎工作正常。
有什么想法吗?
I was told to use version control on my dotfiles.
也许你应该向那些告诉你这样做的人寻求支持,你不觉得吗?
将所有点文件放在一个存储库中不是必要的,甚至不是一个客观的好主意。它可能对某些人有用,但仅如果你设法将你的程序指向那个集中的地方(很好)或者如果你将这些文件符号链接到他们的常规位置(哪种打败了这一点)。告诉您对点文件使用版本控制的人应该已经告诉您如何从头到尾做到这一点。
Vim 期望您的
vim
目录和vimrc
位于默认位置:~/.vim ~/.vimrc or ~/.vim/vimrc
它不会查找其他地方,因此您必须将它们从您的存储库符号链接到它们的预期位置:
$ ln -s /Users/username/dotfiles/.vim /Users/username/.vim $ ln -s /Users/username/dotfiles/.vimrc /Users/username/.vimrc
将所有点文件放在同一个目录中的想法并不坏,因为@romainl 在他的回答中说你必须将它们符号链接到它们原来的位置。
这就是我所做的,因此您可能对 script I created to automatically save the current dotfiles in my home directory and replace them with a simlink to the dotfiles in my repo. (You can also clone my repo 感兴趣,将点文件替换为您的点文件并执行脚本。我试图让自述文件尽可能清楚,但如果您有兴趣使用我的解决方案,请不要犹豫给我发消息寻求支持)