Why would ag (silver searcher) in vim ignore files with emojis? - vim

Some files stopped appearing when using the silver searcher in vim... and I just figured out that it happens when certain emoji combinations are inside the file. Even if those emojis are further down, after the term I'm looking for, the file doesn't show up in search results.
I removed emojis, and ta-da file is included in search results again.
It's only certain emojies, When I leave this emoji in:
... then there's no problem.
However if I have a line that looks like this:
diff is like this:
then it doesn't show up in search results.
Why could this be?
Using this table: http://unicode.org/emoji/charts/full-emoji-list.html
I'm trying to figure out how to display 👧🏽 using markup that doesn't make ag exclude the file.
This is as close as I've gotten: 👧 🏽

Perhaps because they are interpreted as a binary file. Add a "--search-binary" to your search to circumvent this feature:
ag --search-binary "pattern"

Friend of mine took a look and found that this:
https://github.com/ggreer/the_silver_searcher/blob/e081d080d1cc0ac24c7ca5f7da6fc4c9dfe35d0b/src/util.c#L324
might be the reason.
" The reason (which you'll detect if you run "ag -a Elixir") is that the color codes somehow makes ag think you're looking at a binary. "
I'm off to try to create an issue.

Related

Looking for a package for sublime like task list in notepad++?

The package should work as:
I specify a word
The package open a (dock) window, show all lines in the source file that have the word.
I could use the lines in dock window to jump between the source file.
Thank you!
Not really sure what the task list in notepad++ is like, but it sounds like you want something to search for TODO entries. Take a look at https://github.com/robcowie/SublimeTODO. Though assuming your tagging is accurate, you are using ST3, and this plugin has not been ported. If that is true, you may want to check out https://github.com/dnatag/SublimeTODO, which is supposed to provide the ST3 compatibility. Note I haven't tested it, but based on some of the comments in the pull request, it seems like it might work.

vi text search with exclude (linux)

I have a huge log file (25.3 million lines) with errors and I won't to search it without holding down the up button. How can you search this with vi? I've seen similar at directory levels but not particular files. At the moment I've searched a date e.g. /Tue 15 Jan
and navigated down but I'm not sure when problems may have began (only when noticed) so I need a general search.
My general idea from within the file would be /ORA-/!ORA-00020
meaning that I want to find those strings containing "ORA-" but ignoring those that are "ORA-00020". Any idea how this can be done viewing a particular file?
Thanks for any info
You do
grep -v "ORA\-00020" error.log > error2.log
then you search error2.log
I don't know the exactly way on vi, but we have kind of ways to get the result:
we can use cat/grep commands and write the answers in another file (so we have much smaller file) and then you can search in it, if it will be ok.
you can use vim instead vi and use TagList Vim Plugin.
Additional info at:
http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-editor-as-sourece-code-browser/
http://vim-taglist.sourceforge.net/faq.html

How to replace/remove specific strings from html file using Notepad++?

I've export my bookmarks from FF in to a html file but it's too huge and complicated, so I need to remove some firefox lines from it to make it more lighter and plain.
I can replace basic things in the Notepad++ but I guess I do need some operators for this and I have no idea how to make it work right.
For example here is the line from the file containing a link to Logodesignlove :
Logo Design Love
I need to remove all those tags I don't care about, like LAST_MODIFIED="1256428672", ICON_URI="bunch of digits" ICON="bunch of characters" etc.
And of course I need to remove all those tags in every link in the list.
So I was thinking like use something like "Find all tags LAST_MODIFIED="anynumbers" and replace it with nothing/remove it" - it doesn't work though.
Examle how it should like:
Logo Design Love
So far I removed LAST_MODIFIED and ADD_DATE lines thanks to Aleksandr. So LAST_MODIFIED="\d+" worked just fine. But ICON and ICON_URI are still there. I've tried ICON="\w+" - but it doesn't work. I guess it has something to do with the slashes.
Why look for what you don't want when it's easier to keep hold of what you do want and drop the junk?
(<A HREF=".*?").*?(>.*?>)
with
$1$2
Code edited to suit Notepad++ now I know it doesn't need the special chars escaped. Thanks Aleksandr.
Read up on using regular expressions (the java regex tutorials are a good start http://docs.oracle.com/javase/tutorial/essential/regex/), and try one of the online regex tools to help write and test it, such as this one http://gskinner.com/RegExr/
Eg, remove "LAST_MODIF..." with the regex LAST_MODIFIED="\d+"
Otherwise, you may want an XML-specific tool, or even write an XSL. However, I don't know much about that.

How do I view a log file generated by screen (screenlog.0)

So I just found out I can create log files of everything I do in screen (C-a H). Sounds like a nice way to keep track of potential goofs in a particular screen session. However, when I went to try it out the logfile is reported as being a binary file (and can't be viewed like a regular text as such). So am I missing something? A quick man page looksee and searching Google (and SO) turns up nothing about this.
So my question is: How do I generate plain text log files in screen?
Assuming the answer is "What a noob... how about you try making them? RTFM." my question becomes: How do I use less to view screen logfiles I've created (since less screenlog.0 does not work on a binary file)?
EDIT: So cat works fine but less complains that the file is binary... why?
SOLUTION: as jcomeau_ictx helpfully pointed out, you can view these logfiles fine with cat or more but with less you must add the -r flag less -r screenlog.0
I just found a screenlog.0 on the net; it is plain text, with some escape sequences. Just 'cat' the file, you should be able to view it just fine.
[after more checking]
Control-A H is what generates the screenlog on my system. And though 'cat' works, you'll miss a lot of data. Use 'more' instead of 'less' to interpolate the escape codes.
I found neither less nor more nor cat to be an ideal solution for viewing screenlog files. All "replay" some of the control character so that e.g. screen deletions as produced by "clear" (don't remember the corresponding control character) are beeing shown, hiding what has been cleared.
What i know works great is: use "view" or "vi", it just shows the control character in escaped notation. Probably any other text editor works, too (not tested).
-L logs to file,
tail -f 'logfilename' to monitor this file

Auto format a file to print in Vim

Sometimes I work with a file that contains source code, columns, plain text, sometimes all 3. It looks great on the screen. However, when I send it to a printer, it comes out a mess: columns/tables are misalignment, code looks like a spaghetti, etc.
I use Vim (7.2). How do I reformat the file to please the printer?
Perhaps I should shorten the length of a line?
How do you send it to printer? Try :hardcopy command.
You can also lookup printing-related options printfont, printdevice, printoptions, etc.
See also printoptions and others on vimdoc.sourceforge.net
It's not a pure-Vim solution, but I've had good experiences with GNU a2ps for converting (relatively) poorly formatted text documents (a couple Project Gutenberg titles, to be specific) to a nice, printable pdf/postscript file.
If you aren't worried about having to have a one-step process with no intermediary between Vim and the printer, here is a fairly flexible strategy.
If you have a dark background in Vim with light foreground but would like to print black-on-white since white-on-black is great for terminals but not so great for printed media, try colorscheme shine. (Another nice colorscheme for this is Hemisu, which is superior to Shine for printing diffs.)
Use :TOhtml to convert the document to HTML.
Save the file and open it in your browser.
Open print preview from your browser and set up the window appropriately.
For example, I just printed a nearly 200 column file brought in from Vim this way, and it worked out fine (both in the sense of "well" and in the sense of "small print" :) because I was able to use Firefox's print preview to set the file to print in landscape mode.
Print the file from your browser.
I agree there is a problem. yim has 'formatoptions' to 'wrap' lines together the way you want and break lines at appropriate places ('linebreak', 'breakat') which would give you an elementary wysiwyg word-processing capability, except that it only works on the display and has no effect when sent off to print.

Resources