Tagged Questions
2
votes
1answer
78 views
bash script - supervisor program
I have to write a shell-script that have to do the following tasks:
-in every 5 seconds it saves:
-how many users are using joe and/or vi;
-if ...
2
votes
3answers
54 views
Open multiple files in Vim with a filelist
I have a file 'filelist' that contains the following lines:
text1.txt
text2.txt
text3.txt
I am looking for a command line invocation that opens the 3 files in vim. I tried the following:
$ cat ...
1
vote
2answers
76 views
How do I set bash aliases and variables from within vim?
In cmdline mode, the following examples do not work for me.
!alias lol='echo lol'
!lol='echo lol'
2
votes
3answers
67 views
Ctrl+W in vi[m] to erase to whitespace
I want to mimic the functionality of bash readline in vim. Is there an easy way to do that?
Currently in vim Ctrl+W "cuts" from cursor back to special char or whitespace.
ie. In bash Ctrl+W "cuts" ...
1
vote
2answers
360 views
vim how to configure backspace and delete key's both as normal
How to configure following keys in vim?
Backspace key to delete a character backwards.
Delete key to delete a character forwards.
After reading some posts, I got to know that only one of those can ...
2
votes
4answers
153 views
Remove large chunks from json using vim
I have a huge file (1/2 million lines) of json.
I need to delete a set of entries that contain a certain string.
{
"bla1": {
"Part1": "Plop1",
"Part2": "Plop2",
"Part3": ...
17
votes
9answers
983 views
Bash commands inside vi
Is it possible to type a bash command inside vi and get the stdout?
I find it often tedious to close and reopen vi just because I want to look something up in the shell.
3
votes
2answers
147 views
place the aliased version of an existing command in /usr/bin/
I use Vim a lot, and I know how I can start vim in insert mode. So I have an alias named vii in my .bash_aliases file.
On other hand I use Git a lot too, and I have this line in my .gitconfig:
...
4
votes
1answer
415 views
How to skip vim message “Press Enter…” after running bash commands
After running bash commands(e.g !mv file1 file2) vim outputs result of that command and prints this message:
Press Enter or type command to continue
Is there a way to skip this message and return to ...
4
votes
3answers
319 views
Run a vim macro from inside a bash script
In a bash script I want to edit a file. Is there a way to write a macro in vim, save it and then call it in bash script?
1
vote
2answers
501 views
Script to create files in a template
I just wrote a function in my ~/.bashrc that will let me create a folder for a new website with one command. The function looks like this:
function newsite() {
mkcd "$*" # mkdir and cd into it
...
8
votes
3answers
1k views
Advantages of using set -o vi
I have seen many developers using this command to set the option to vi. I never understood the real use of this?
When using bash commands, what help does switching to vi provide?
7
votes
1answer
352 views
Note-taking and outlining using Vi: On startup, highlight tags and display tags in a preview window
I am using vi as a note-taking and outlining tool and therefore I thought that this stackexchange site would be appropriate to ask this question. I am constructing the "tags" file by myself. What I ...
7
votes
2answers
160 views
How do I get just the user-manual for Vim
To get the vim user-manual I am doing
vi test
and then, once the file is opened, I do
:help user-manual
This opens up a split window, which makes reading manual inconvenient to read. How do I ...
3
votes
2answers
502 views
How to map one vim command to execute bash commands based on OS?
In short, can single bash commands in the terminal contain conditionals? If so, how?
I have in my vimrc (shared across systems) the following command to open my current LaTeX document in .pdf form:
...
4
votes
7answers
522 views
Open a file given by the result of a command in vim
I find myself doing the following almost every day
Run a find (find -name somefile.txt)
Open the result in vim
The problem is I have to copy and paste the result of the find into the vim command. ...
14
votes
1answer
1k views
Is it possible to have vim key bindings in terminal?
I'm getting used to vim bindings (like pressing w to go to word, dw to delete a word, and such) and it's modes (insert, normal, visual), and, out of curiosity would like to know: is there some kind of ...