Skip to main content
5 votes

Why GVim doesn't use dark theme?

Starting gvim with the environment variable GTK_THEME explicitly set appears to work: $ GTK_THEME=Adwaita:dark gvim
srjs's user avatar
  • 51
5 votes
Accepted

How to delete a line which contains a specific syntax but I want to avoid a line which contains another word

You could use: :v/module/s/\v.*(sup|gnd).*// :v/pattern/cmd runs cmd on the lines that do not match the pattern \v turns on very-magic so that all the (, | characters are treated as regexp operator ...
Stéphane Chazelas's user avatar
4 votes
Accepted

Comment from start of file to a pattern matched line using sed

As a one-liner to demonstrate the concept : echo -e 'a\nb\nc\nPATTERN\nd\ne\nf' | sed '0,/PATTERN/ s/^/#/' You just have to adapt to your context : as for the 'PATTERN' I assumed '#' as the ...
Httqm's user avatar
  • 1,168
4 votes
Accepted

Differences in launching a program through terminal and through an application launcher

One common cause of this type of error is differences in the shell environment. Most likely your PATH variable and/or your current working directory is different and affecting your script. You can ...
RobertL's user avatar
  • 6,940
4 votes

vim shortcut to open a file under cursor in an already opened window

I searched for the same VIm's function and found out this solution which works like charm: map <F8> :vertical wincmd f<CR> Source page.
waldauf's user avatar
  • 375
3 votes

vim shortcut to open a file under cursor in an already opened window

This worked for me: function! OpenFileInPrevWindow() let cfile = expand("<cfile>") wincmd p execute "edit " . cfile endfunction nmap ,f :call OpenFileInPrevWindow()<CR>
sirex's user avatar
  • 131
2 votes
Accepted

Run gvim in terminal

You can run gvim in TUI mode by passing -v, but note that you won't have the X clipboard registers unless you're running it under X.
Ignacio Vazquez-Abrams's user avatar
2 votes

vi/vim, how can I write out the nth word of all lines to a new file

:!cut % '-d ' -f2 > new_file.txt Note that the default delimiter of cut is tab, so you'll want to use '-d ' to set the delimiter to space. From inside of Vi you can use % as the replacement for ...
mysan's user avatar
  • 21
2 votes

vi/vim, how can I write out the nth word of all lines to a new file

First step, delete all but the second word on each line. This is a fairly straightforward :%norm command: :%norm dwwhD Which is like manually typing out dwwhD on each line, but faster. Second step, ...
DJMcMayhem's user avatar
1 vote

Comment from start of file to a pattern matched line using sed

Your question asks about sed but includes the gvim tag, so here is an ed/ex answer: ed file <<EOF 0,/"$pattern"/s/^/"$comment_char"/ wq EOF That it looks remarkably like the sed answer is ...
D. Ben Knoble's user avatar
1 vote

vim shortcut to open a file under cursor in an already opened window

I got annoyed enough about the above answers from 2013 not quit working reliably in the situations I cared about, and wrote slightly-more-robust functions to handle them. For gF specifically (i.e. ...
ELLIOTTCABLE's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible