I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
w and b move forwards and backwards in normal mode, not command mode. In command mode, you have the little : prompt and can enter instructions for the editor to execute.
dw deletes from the cursor to the start of the next "word". To delete the word you're currently on, you'd use diw, daw, diW, or daW depending on exactly how you wanted to do it.
:%s/old/new will replace "old" with "new" in every line of the file, but it will only replace the first occurence of "old" in each line. If you want to replace every occurence, you'd pass the g flag like so: :%s/old/new/g
Your :w example suggests that it will use the filename "sample_filename" but you haven't put that in the command. It'd need to be :w sample_filename for that to work!
I think some of these are slightly wrong:
w
andb
move forwards and backwards in normal mode, not command mode. In command mode, you have the little:
prompt and can enter instructions for the editor to execute.dw
deletes from the cursor to the start of the next "word". To delete the word you're currently on, you'd usediw
,daw
,diW
, ordaW
depending on exactly how you wanted to do it.:%s/old/new
will replace "old" with "new" in every line of the file, but it will only replace the first occurence of "old" in each line. If you want to replace every occurence, you'd pass theg
flag like so::%s/old/new/g
Your
:w
example suggests that it will use the filename "sample_filename" but you haven't put that in the command. It'd need to be:w sample_filename
for that to work!Thank you for your feedback Ben! I've made the corrections accordingly.
or to delete from the cursor to the end of the word you are on de