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
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 ...
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 ...
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 ...
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.
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>
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.
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 ...
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, ...
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 ...
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. ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
gvim × 77vim × 51
vimrc × 8
linux × 6
vi × 6
rhel × 4
editors × 4
bash × 3
x11 × 3
fonts × 3
gtk × 3
ruby × 3
shell-script × 2
debian × 2
windows × 2
kde × 2
keyboard-shortcuts × 2
i3 × 2
ide × 2
sed × 1
arch-linux × 1
fedora × 1
filesystems × 1
regular-expression × 1
software-installation × 1