I'm trying to view some log files in zst format. I can use zstdcat to view the content, but when I do vim <filename.zst>, there're only garbled text. Is there a similar way as zstdcat to view zst file with Vim as well?
You use Zstandard to compress data so a *.zst file is not readable text and there is no point opening it directly in a text editor. You will have to decompress it first, which is what zstdcat does:
zstdcat is equivalent to zstd -dcf
and then open the decompressed text in Vim.
To view the content of a *.zst file in Vim, from your shell:
$ view <(zstdcat filename)
$ zstdcat filename | view -
To view the content of a *.zst file from Vim:
:enew | r !zstdcat filename
Note that, in both cases, you are not viewing the *.zst file itself but a copy of its decompressed content.
Of course, the whole thing could be streamlined and turned into a plugin similar to :h zip.
Related
I would like to have the Notepad++ autocomplete feature
ignore dashes
include apostrophes
when working on plain text files. I cannot find a plain text XML definition file in the autocomplete directory: C:\Program Files (x86)\Notepad++\plugins\APIs\
Is there any way to change the standard search functionality for plain text files in Notepad++?
I don't know if you can change the search functionnality, but you can create a normal.xml file under C:\Program Files (x86)\Notepad++\plugins\APIs\ directory to change the autocomplete feature for normal text files
QuickText is a free plugin for Notepad++ that you can use to add text snippets to the application. You define a tag and substitution text, and only need to type the text in Notepad++ and press Tab afterwards to replace it automatically with the selected substitution text.
credits:http://www.ghacks.net/2014/02/22/work-text-snippets-notepad/
OR
I Personally Suggest You to try Sublime Text and its is the Most Customize able Text Editor which may be Extended to your own Needs. It is the Best Text Editor in the Current scenario.
I have indexed my c++ codebase with ctags, I can open a header file as follows:
:tag myfile.h
(It doesn't matter where myfile.h is located, as long as it is inside the indexed codebase it will open correctly in vim)
When I'm editing a c++ file, I can get the header filename as follows:
:e%<.h
e.g. when editing myfile.cpp, executing this command will display myfile.h on the command line.
A file can be opened in vertical split, by issuing:
:vs <myfile>
Now what I want to accomplish, is to have 1 command or function which I can use to open a header file of the corresponding c++ file that I'm currently editing in vertical split. Hence basically I want to combine the 3 above commands as if I would be doing a Unix pipe, e.g.:
:vs tag | e%<.h
" :vs to open file in vertical split
" :tag to find tag
" :e%<.h to get header filename
Obviously the Unix pipe doesn't work on vim, alternatively I've tried to write a function at which I assign the result of a command to a variable, e.g.
headerFileName = :e%<.h
Which apparently is not the correct way of doing this, I'm a bit lost here so I hope somebody can provide some help.
There exist several plugins that already do this (without needing a ctags database BTW).
For instance, with alternate (aka a.vim), you just have to type :VS from the header file or the source file to open the other one in a vertically split window.
Note that alternate have an option to tell where to find the other file (same directory, substitute on directory name, ...)
Otherwise, I suspect you are looking for expand() and :exe. If you write a function it may be
function! s:whatever() abort
let crt = expand('%:t:r')
vnew
exe 'tag '.crt.'.h'
endfunction
command! whatever call s:whatever()
I downloaded the DrawIt plugin to draw a diagram in vim. I successfully installed that plugin.
Then I found DrawIt.vba file in my home directory and opened the file. It had the following content:
" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.
UseVimball
finish
+-- 67 lines: plugin/DrawItPlugin.vim--------------------------------------------
+--484 lines: plugin/cecutil.vim ------------------------------------------------
+--1662 lines: autoload/DrawIt.vim-----------------------------------------------
+--401 lines: doc/DrawIt.txt-----------------------------------------------------
In that file, I placed the cursor in the + (plus) and I pressed the right arrow key(->).
It opens the specified path (plugin/DrawItPlugin.vim) of the file.
I really wonder about that one.
I want to create something like this. I searched in NET, but I didn't get any proper way to do it.
Can you help me do this?
Actually, that is not what is happening.
"Vimball" files are archive type files that contain number of other files in them. When you "source" such file, Vim extracts these files into specified paths, for example the content under plugin/DrawItPlugin.vim will get extracted into a file with that name inside your $VIM directory.
What you actually describe is an example of folding. Vim can "fold" parts of a file, so that they are hidden, and replaced by just one line.
+-- 67 lines: plugin/DrawItPlugin.vim--------------------------------------------
means that there is 67 lines of hidden content, starting with the text plugin/DrawItPlugin.vim. When you navigate the cursor into this text, it gets unfolded.
Type :he folding in Vim to read the Vim help on folding.
You can "jump" to a file whose path is under cursor with gf (goto file). Type :he gf for details.
Finally, using the "VimWiki" plugin, you can create files that link to other files, in a Wiki fashion.
Is there a simple way to (in VIM) do save the currently open file with it's current name plus an appended phrase?
IE, from /home/affert/ type vim /data/folder/file1.txt
then save the file as /data/folder/file1.txt_BACKUP without needing to copy and paste the filename?
Context: I have a file that has full paths in it to other files in other folders. I use ctrl+W, ctrl+F to open the file in a new window. That's why I don't want to copy and paste. BTW, the folder and file names are a lot longer, so typing them myself is not a useful option.
:w %:p_BACKUP
For explanation see How can I expand the full path of the current file to pass to a command in Vim?.
Easy:
:w %_BACKUP
If you need override:
:w %_BACKUP!
The it gonna answer:
"filename_BACKUP!" [New] XL, XC written
If :h is used in VIM, it will automaticall follow |links| via CTRL+], opening new help topics and maintaining tag jumps list (CTRL+T will go back in jumps history). How to implement such behavior in my own file format? For example, i want CTRL+] on text inside {} to open a file named something.txt and CTRL+T to go back. How to implement this?
It's all done with tags. Essentially the vim files are simple text files, but they're supported by a file in the same directory named 'tags'. All this file contains is entries that look like:
'bg' options.txt /*'bg'*
'bh' options.txt /*'bh'*
'bin' options.txt /*'bin'*
'binary' options.txt /*'binary'*
'biosk' options.txt /*'biosk'*
'bioskey' options.txt /*'bioskey'*
Each line is a tag entry, split over three fields: the tag identifier, the file the tag lives in, and the ex command to find that tag: any ex command works; as can be seen in the example above though, the vim help files just use the search command: '/'.
You can either write a tags file manually, or use a program such as Exuberent ctags to create the file automatically. The tags file is generally read from the same directory the file you're editing lives in, but you can change this in Vim by adjusting the value of the 'tags' option.
More details in vim if you type ":help tags"