我使用putty连接远程主机并通过vim进行编辑.当我尝试将某些内容粘贴到vim时,我遇到了麻烦.就是这样,我将东西复制到我本地主机的剪贴板中,并希望将其粘贴到远程主机中的vim中.怎么做?
ps:我正在使用腻子!所以,我通过putty打开一个vim窗口.我非常需要在本地主机中复制一些内容并将其粘贴到putty打开的vim编辑器中.就这样.谢谢!
我想出了一个关于git pull的问题.
首先,我在"test_http_1204"分支,
root@inception-server-Quantal:~/bosh# git branch
master
* test_http_1204
ubuntu1204
Run Code Online (Sandbox Code Playgroud)
然后我使用git pull,并收到错误消息,
root@inception-server-Quantal:~/bosh# git pull m109bosh test_http_1204
fatal: Couldn't find remote ref test_http_1204
Unexpected end of command stream
Run Code Online (Sandbox Code Playgroud)
但是,我可以在我的远程仓库"m109bosh"中找到分支"test_http_1204",
root@inception-server-Quantal:~/bosh# git branch -a
master
* test_http_1204
ubuntu1204
remotes/m109bosh/master
remotes/m109bosh/patch-1
remotes/m109bosh/test_http_1204
remotes/m109bosh/ubuntu1204
remotes/origin/HEAD -> origin/master
remotes/origin/floating_dns_registry
remotes/origin/http_stemcell_uploader
remotes/origin/master
remotes/origin/squashed
remotes/origin/ubuntu1204
remotes/origin/upstream
Run Code Online (Sandbox Code Playgroud)
并且.git/config的内容如下所示:
root@inception-server-Quantal:~/bosh# cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/cloudfoundry-community/bosh-cloudstack-cpi.git
[branch "master"]
remote = origin …Run Code Online (Sandbox Code Playgroud) 假设使用类变量的简单ruby程序,
class Holder
@@var = 99
def Holder.var=(val)
@@var = val
end
def var
@@var
end
end
@@var = "top level variable"
a = Holder.new
puts a.var
Run Code Online (Sandbox Code Playgroud)
我想结果应该是99,但输出不是99.我想知道为什么.由于类变量的范围是类,我假设该行@@var = "top level variable"不会影响类中的变量.
在Apache CloudStack上注册ISO或模板时出现问题.
当我完成并提交注册ISO表单时,不会出现错误消息.但是,如果我检查模板,"就绪"字段中的结果为"否","状态"字段为空!我无法创建实例,因为我无法注册自己的ISO或模板.
我正在使用Ubuntu 12.04 LTS,我的系统虚拟机已经在运行!所以,我只是不知道为什么.你能帮我吗?
我打算将一些东西从vim编辑器复制到shell命令行.我尝试了很多方法,但我发现所有这些方法只能在同一个vim编辑器中工作.我需要在vim编辑器和shell命令行之间复制和粘贴.那就是,vim - > shell
PS:我正在使用腻子.
编辑:
顺便说一句,如果只是从vim编辑器复制一些内容并将其粘贴到unix/linux盒子中的终端怎么办?
注意:
输出:vim中的echo has("X11")为0,所以我的系统不支持X11!
我遇到一个简单的程序有关Dir[],并File.join()在Ruby中,
blobs_dir = '/path/to/dir'
Dir[File.join(blobs_dir, "**", "*")].each do |file|
FileUtils.rm_rf(file) if File.symlink?(file)
Run Code Online (Sandbox Code Playgroud)
我有两个困惑:
首先,第二和第三参数的含义是File.join(@blobs_dir, "**", "*")什么?
其次,Dir[]Ruby中的用途是什么?我只知道它等同于Dir.glob(),但是我不清楚Dir.glob()。
我是ruby的新手,当我对某些程序感到困惑时,我想跟踪ruby程序的执行过程.我想知道是否有一种方法可以像shell脚本set -x那样帮助我跟踪?
PS:
比如shell脚本test.sh:
set -x
ls /home
echo "hello dujun and haotianma!"
Run Code Online (Sandbox Code Playgroud)
当我执行test.sh时,输出将如下:
+ ls /home
dujun haotianma
+ echo 'hello dujun and haotianma!'
hello dujun and haotianma!
Run Code Online (Sandbox Code Playgroud)
就像这个bash脚本在执行它之前回应每个语句一样,我想让Ruby程序显示哪些语句正在执行.
假设有两种ruby File操作.
首先,
file = File.open("xxx")
file.close
Run Code Online (Sandbox Code Playgroud)
其次,
file = File.read("xxx")
file.close
Run Code Online (Sandbox Code Playgroud)
众所周知,我们应该在完成使用后关闭文件.但是,在第二个代码块中,Ruby解释器抛出如下所示的错误消息:
in `<main>': undefined method `close' for #<String:0x000000022a3a08> (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
我不需要file.close在第二种情况下使用?我想知道为什么?
我想删除光标位置后的部分vim.例如,一行看起来像这样:
abcdefghijklmn
Run Code Online (Sandbox Code Playgroud)
并且光标的位置是字符c,我想删除以d.开头的字符.换句话说,我想删除defghijklmn并离开abc.我怎样才能vim优雅地使用命令?
PS:目前我只是按下Backspace键.
更新:如何从光标位置删除到begining当前行?
考虑一段Go代码:
var infile *string = flag.String("i", "infile", "File contains values for sorting")
我想知道*字符串在Go中意味着什么?