• 5 Posts
  • 761 Comments
Joined 1 year ago
cake
Cake day: August 2nd, 2023

help-circle









  • toynbee@lemmy.worldtoComic Strips@lemmy.worldDad always knows
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    1 day ago

    I remember something like this from a Bruce Coville book where they’re trying to get a character out of suspended animation or something. The protagonist of the book enters the room alone and the suspended character “slowly” winks at them. This “burst of activity” brings scientists rushing into the room because it was so unexpected, but the suspended character is back to inactivity by the time they get there.

    Unfortunately, that’s all I remember.







  • Apologies in advance for the WOT. I will not be offended if you don’t read it, but I did try to include helpful information.

    So, for reference, though this command should work it’s not the correct way to exit vim (for several reasons). Also, if nano works for you, then there’s nothing wrong with using it. IMHO you lose a lot of the power of vim, but some of the beauty of linux is that customization is big part of it. One of the smartest and most linux-knowledgeable people I know uses nano and can outperform me in basically every linuxy way.

    Also, a caveat: I know some stuff, but I’m not an expert in anything, let alone neat stuff like this. The text below is accurate to the best of my knowledge, but may not represent the whole of the paradigm.

    Now, to answer your question: vim is what’s called modal. You have two primary modes: editing (amusing edit: this is also called “insert” mode) and command. Editing mode is what it sounds like: When you’re editing a file. This mode is usually entered by pressing a button that starts the process of changing the file - stuff like i (for insert mode, which just starts adding text you type where your cursor is) or o (which starts adding text you type on the next line) or many others. This mode is exited by pressing Esc, which leaves you in command mode. In command mode, you can start with a :, which generally goes to a field (not the right word, but the one I’m using) at the bottom of the window/screen. This is the command. The command can be extremely complex and even chained. People who are more into vi(m) than I am call it a sentence, I believe, but I might be misinterpreting that. (You can also type things without a : but those will have different kind of impact.)

    So, to run the command I posted above, you would start by pressing Esc to make sure you were in command mode (if you already are it will just maintain command mode). Then you would type : to start the command (or possibly sentence). Then you would type the !, which tells vim that this command is to be run in the shell, rather than as a vim command. Then you would type pkill vim which is a command that would tell the shell to identify a process called vim and kill it. This would exit vim but is, again, not the correct way to do so.

    The usual way to exit vim correctly would be to press Esc to make sure you were in command mode, then type one of the following:

    • :wq (write and quit)
    • :q (quit without saving the file)
    • either of the above with a ! after it (e.g. :wq! or :q!) which tells it to ignore errors (:q will complain if you have made any unsaved changed but adding ! will ignore those complaints)
    • press ZZ (I’ve not used this myself, but I think it’s equivalent to :wq)

    One last aside: If you do decide to try to use vim, this is a useful resource: https://vimschool.netlify.app/introduction/vimtutor/

    edit: Very small formatting changes.

    edit 2: Just some random facts because vim is cool:

    • You can type :! with no other text to see the terminal from which you launched vim, then press enter to return to your active vim session, which can be useful if you’re trying to replicate text in an environment where you can’t copy and paste (and probably other circumstances)
    • Adding % before any command applies it to the whole file (rather than, for example, just one line) which can be useful if you’re trying to sort a file (and in other circumstances):
    %!sort
    

    (without the % it would just try to sort the current line, which likely wouldn’t be too useful since I believe it only goes by the first character of the line unless you present other arguments)


  • I saw your comment much earlier but was in the middle of my workday and I didn’t have time to review it until now, so I apologize for the delay.

    Your answer is interesting, insightful and educational, for all of which I am grateful. I hadn’t considered that perspective and it is all of the adjectives I listed previously.

    However, I don’t think it answers at least what I meant by the original question, even if it does answer the literal question I asked. That’s on me for not using sufficiently specific language. What I meant wasn’t “why do things obey the laws of physics as we understand them” or “why do things obey the laws of physics as we’ve defined them” but more “whatever the laws of physics truly are as defined by the universe, what makes the content of the universe obey them?” I was quite young when I asked my dad the question, so at the time I pictured little Marvin the Martian style physics policemen following atoms around enforcing the law, but I suspect that’s not correct.

    My question is possibly more philosophical than scientific (or realistically answerable). At that age I was certainly not aware of the simulation hypothesis, which seems like a good starting point, but also raises more questions. Regardless, I appreciate the clearly genuine effort behind your answer as well as the pontification it inspired, at least for me.

    An aside: your comment reminded me of the “Maxwell’s Demon” Abstruse Goose comic (which sadly I can’t find to link here) and this Simpsons bit, which clearly I was able to find to link.

    https://youtu.be/tuxbMfKO9Pg

    I want to reiterate one last time that people who try to answer questions and educate others are extremely valuable and I meant nothing negative about your comment. Thank you for responding.