我只是想知道是否有人可以帮助如何使用vi执行以下操作.
我有一个文本文件,它可能包含类似的东西
start of text file:
--something1.something2--
--anotherThing1.something2--
end of text file:
Run Code Online (Sandbox Code Playgroud)
如果我想取这行并通过搜索与第一次出现的[A-Za-z0-9]副本相匹配的任何内容转换为缓冲区,然后将其附加到第一个出现之前的同一行 -
start of text file:
--something1.something2.something1--
--anotherThing1.something2.anotherThing1--
end of text file:
Run Code Online (Sandbox Code Playgroud)
是否有一个VI命令来执行此操作?
干杯本
对于Vim来说,我是一个初学者,它目前在很多方面让我感到恼火.其中之一是:
假设我在文件中有以下文本
one
two
three
four
dog
frog
log
mog
Run Code Online (Sandbox Code Playgroud)
并且我使用视觉模式选择数字(4行)如果我然后使用P粘贴在狗的'd'我得到以下内容:
one
two
three
four
one dog
two frog
threelog
four mog
Run Code Online (Sandbox Code Playgroud)
我想要的输出是:
one
two
three
four
one
two
three
four
dog
frog
log
mog
Run Code Online (Sandbox Code Playgroud)
我注意到它表现得像我期望的那样,如果我做y4y而不是直观地选择线条.那么是什么导致了我所看到的行为上的差异?如何根据需要将我的视觉选择块粘贴?
我正在尝试裁剪图像,然后将裁剪后的图像粘贴到另一个图像的中心.理想情况下,我希望裁剪的图像比粘贴的图像小,以便在粘贴的图像周围有边框,但我不知道是否可能.
这是我尝试过的(以及产生的错误消息):
>>> import Image
>>> grey = Image.new('RGB', (200, 200), "grey")
>>> House = Image.open("House01.jpg")
>>> print grey.size, grey.mode, grey.format
>>>(200, 200) RGB None
>>> print House.size, House.mode, House.format
>>>(300, 300) RGB JPEG
>>> box = (25, 25, 25, 25)
>>> House.crop(box)
>>>Image._ImageCrop image mode=RGB size=0x0 at 0x11AD210>
>>> region = House.crop(box)
>>> region.show()
>>>Traceback (most recent call last):
>>> File "<pyshell#28>", line 1, in <module>
region.show()
>>> File "C:\Python26\lib\site-packages\PIL\Image.py", line 1483, in show
_show(self, title=title, command=command)
>>> File …Run Code Online (Sandbox Code Playgroud) File1 Contents:
line1-file1 "1"
line2-file1 "2"
line3-file1 "3"
line4-file1 "4"
File2 Contents:
line1-file2 "25"
line2-file2 "24"
Pointer-file2 "23"
line4-file2 "22"
line5-file2 "21"
Run Code Online (Sandbox Code Playgroud)
执行perl/shell脚本后,
File 2 content should become
line1-file2 "25"
line2-file2 "24"
Pointer-file2 "23"
line1-file1 "1"
line2-file1 "2"
line3-file1 "3"
line4-file1 "4"
line4-file2 "22"
line5-file2 "21"
Run Code Online (Sandbox Code Playgroud)
即在包含行的"指针"之后,将文件1的内容粘贴到文件2中.
谢谢
我有文件,信息由选项卡分隔.我想将计算值附加到每个特定文件,并尝试使用'paste'命令获取相同的格式,但它会分隔一行而不是一个制表符.该文件看起来像(使用[tab]表示选项卡):
text[tab]=[tab]value
text[tab]=[tab]value
Run Code Online (Sandbox Code Playgroud)
使用选项卡创建单行无法使用粘贴,因为它将打印\ t:
conv <- paste("conversion", "=", (y[,2]/90.6),sep="\t")
Run Code Online (Sandbox Code Playgroud)
但是如果我稍后尝试使用以下方法添加标签:
conv <- paste("conversion", "=", (y[,2]/90.6),sep=",")
write(conv, file = "data.dat", append = TRUE, sep = "\t")
Run Code Online (Sandbox Code Playgroud)
"conv"分开排列:
text[tab]=[tab]value
text[tab]=[tab]value
conversion
=
11.7991169977925
Run Code Online (Sandbox Code Playgroud)
而不是在标签中(我想要的):
text[tab]=[tab]value
text[tab]=[tab]value
conversion[tab]=[tab]11.80
Run Code Online (Sandbox Code Playgroud)
我相信必须有一个非常简单的解决方案,但我根本找不到.谢谢!
WP 3.9.1 TinyMCE 4.x
我在我网站的前端使用wp_editor().问题是当用户粘贴一些带有样式(粗体,颜色......)的内容时,它会出现在tinyMCE4编辑器中.
如何防止粘贴样式?我只想要粘贴文本.
这是代码:
首先,tiny_mce_before_init过滤器:
function mytheme_job_tinymce_settings( $in ) {
$in['remove_linebreaks'] = true;
$in['gecko_spellcheck'] = false;
$in['keep_styles'] = false;
$in['accessibility_focus'] = true;
$in['tabfocus_elements'] = 'major-publishing-actions';
$in['media_strict'] = false;
$in['paste_remove_styles'] = true;
$in['paste_remove_spans'] = true;
$in['paste_strip_class_attributes'] = 'all';
$in['paste_text_use_dialog'] = false;
$in['wpeditimage_disable_captions'] = true;
$in['plugins'] = 'tabfocus,paste';
$in['wpautop'] = false;
$in['apply_source_formatting'] = false;
$in['toolbar1'] = 'bold,italic,underline,strikethrough,bullist,numlist,hr,alignleft,aligncenter,alignright,undo,redo ';
$in['toolbar2'] = '';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
}
add_filter( 'tiny_mce_before_init', 'mytheme_job_tinymce_settings' );
Run Code Online (Sandbox Code Playgroud)
然后在前端(页面模板)中使用wp_editor():
wp_editor( stripslashes( $profile ) …Run Code Online (Sandbox Code Playgroud) 在VIM中,是否有一个命令允许我删除一个范围并将其复制到我的光标所在的位置?或者直接在选定的行中复制它?
例如:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
Run Code Online (Sandbox Code Playgroud)
我可以:
:6,8d
Run Code Online (Sandbox Code Playgroud)
它会将线从6切换到8.如何在第1行之后设法复制它们?
我试过了:
:6,8dp
Run Code Online (Sandbox Code Playgroud)
和:
:6,8d|p
Run Code Online (Sandbox Code Playgroud)
没有成功......
谢谢!
我使用MVVM模式开发应用程序.我使用MVVMLight库来做到这一点.所以如果我需要处理TextBox TextChange我在XAML中编写的事件:
<I:EventTrigger EventName="TextChanged">
<I:InvokeCommandAction Command="{Binding PropertyGridTextChange}"/>
</I:EventTrigger>
Run Code Online (Sandbox Code Playgroud)
哪里PropertyGridTextChange是Command在ViewModel.但TextBox没有Paste事件!
此解决方案仅在应用程序不使用MVVM模式时才有效,因为您需要链接TextBox.
<DataTemplate x:Key="StringTemplate">
<TextBox Text="{Binding Value, ValidatesOnDataErrors=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
重要细节 - TextBox置于其中DataTemplate.我不知道如何处理"粘贴事件".我希望PasteCommand在粘贴文本时调用TextBox.而我需要TextBox.Text或TextBox自身被作为参数传递到PasteCommandMethod.
private RelayCommand<Object> _pasteCommand;
public RelayCommand<Object> PasteCommand
{
get
{
return _pasteCommand ?? (_pasteCommand =
new RelayCommand<Object>(PasteCommandMethod));
}
}
private void PasteCommandMethod(Object obj)
{
}
Run Code Online (Sandbox Code Playgroud) 我正在使用jquery.tagsinput,并希望能够粘贴以逗号或空格分隔的电子邮件地址列表.使用类似这样的东西https://github.com/xoxco/jQuery-Tags-Input/issues/22但它不会添加它们直到我按Enter键 - 尝试触发按键输入事件但它不起作用.模糊事件也没有运气(如下所示).有任何想法吗?
Flat-UI标签基于这个库,我试图实现一个非常相似的行为.
var tidyTags = function(e) {
var tags = (e.tags).split(/[ ,]+/);
var target = $(e.target);
for (var i = 0, z = tags.length; i<z; i++) {
var tag = $.trim(tags[i]);
if (!target.tagExist(tag)) {
target.addTag(tag);
}
}
$('#' + target[0].id + '_tag').trigger('focus');
//This doesn't work.
target.blur();
};
$("#tagsinput").tagsInput({
onAddTag : function(tag){
if(tag.indexOf(',') > 0) {
tidyTags({target: '#tagsinput', tags : tag});
}
},
});
Run Code Online (Sandbox Code Playgroud) 是否可以在粘贴模式下重新映射。
例如,我使用映射jk到<ESC>插入模式inoremap jk <esc>,因此可以轻松退出普通模式。但是当我处于粘贴模式并:pastetoggle重新映射时,它不再起作用。我寻求帮助,:help map-modes但找不到与粘贴模式有关的任何内容。