Emacs Makes Moving Words and Lines Super Easy

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ต.ค. 2024

ความคิดเห็น • 43

  • @MisterConscio
    @MisterConscio 11 หลายเดือนก่อน +5

    On vim:
    dw wP -> Switch with next word
    dw bP -> Switch with previous word
    If the cursor is at the middle of the word use "daw" instead.

  • @ChristopherMaiorana
    @ChristopherMaiorana 11 หลายเดือนก่อน +22

    The mastery of Emacs is a journey.

    • @shell4331
      @shell4331 10 หลายเดือนก่อน

      It is indeed.

    • @adammontgomery7980
      @adammontgomery7980 8 หลายเดือนก่อน

      I gave Doom Emacs a try and thought it was neat; I just couldn't understand it. Later, I tried creating a config from scratch with some help from youtube; it started to become more clear. Emacs is just an elisp interpreter, and you can use functions to operate on the editor primatives like: window, buffer, face, point, etc. It was helpful, to me, to remove all the layers of abstraction in the way (packages that doom provides), to see what was going on. That said, I still have trouble with elisp.

  • @GerhardADittes
    @GerhardADittes 11 หลายเดือนก่อน +5

    Hi & FYI:
    * M-t to transpose "words"
    * C-t to transpose "chars"
    (Works of course also in a standard terminal (which uses Emacs-mode by default).)
    Of course Emacs can do lots of more transposing things -- e.g. C-x C-t to transpose "lines"...
    ...but that's probably beyond the scope. 😉

    • @akashp01
      @akashp01 11 หลายเดือนก่อน

      I copied a piece of elisp code from emacs redux that allowed me to transpose lines before I knew its has a built in function, its set to C-S . For lines I think it's better, but sweet for the words and char transpose

    • @akashp01
      @akashp01 11 หลายเดือนก่อน

      also I suppose that only char transpose would really be useful to correct mistypes, I hardly ever jumble up whole words 😂. But its just so natural to extend it because M is usually associated with linguistic elements, sentences, words etc whereas C is always for general elements. If I remember correctly it says this even in the tutorial!

  • @martinvandenbroek2532
    @martinvandenbroek2532 11 หลายเดือนก่อน +5

    These transpose commands also work on the bash shell where it is very handy if you tend to mix up the arguments on a fancy command. 😊 Me like emacs a lot 😊

  • @gordslater
    @gordslater 11 หลายเดือนก่อน +23

    I once tried Emacs but I needed a keyboard with 105 macro keys to use it and my beard wasn't really long enough to use it to the full potential.

    • @exnihilonihilfit6316
      @exnihilonihilfit6316 11 หลายเดือนก่อน

      You probably went out in the sun and bathed too often, as well.

    • @akashp01
      @akashp01 11 หลายเดือนก่อน

      skill issue. All these people who complain about emacs with these inane complaints are either low skilled lab rats or are just plain lying about using emacs. You need a full keyboard to use ms excel even properly, the most macro keys you need in vanilla emacs are Alt Ctrl C and X, rest is all your choice, brain dead trolls

    • @prism223
      @prism223 8 หลายเดือนก่อน

      I grew a beard and made a custom keyboard layout, I am ready

  • @themisterchristie
    @themisterchristie 11 หลายเดือนก่อน

    Back in my DOS days in the late 80s, early 90s, i had a word processor that had the transpose words feature. It was a great feature and I'm surprised software like Word or LibreOffice don't have it.
    The program was some small one, came with stickers for your keys with the different functions marked on them.

  • @noahmihalik4661
    @noahmihalik4661 10 หลายเดือนก่อน

    Hey DT, I just started using doom emacs org for writing documents and taking notes. I'm having issues with org tables and cells containing sentences. and causing the whole table to wrap and basically make it unusable. Have you found a solution? There are some online, including in the org documentation, as well as switching to table.el then back to org table but I'm having trouble with the keybindings. I can't even seem to reduce the cell width to hide the contents? I'm guessing maybe the keybindings in Doom emacs are different or something, but I can't find any evidence of that. Have you found any solutions/workflows to do this more quickly and a little less painless? Any help would be super appreciated.
    P.S. your videos have been an amazing resource for doom Emacs. Thank you!

  • @dacritter8397
    @dacritter8397 11 หลายเดือนก่อน

    But, are all these additions already updated into DTOS? Minds inquiring know to want!

  • @anon_y_mousse
    @anon_y_mousse 11 หลายเดือนก่อน +1

    For that first example, I wouldn't use `dw` because then you have to go back one or possibly more had you used a different example line, I'd use `de` because it stops at the end of the word. If you really need to see the text as you're moving it, plugins exist for Vim to do just that. I also would avoid those single line mappings as it'd be better implemented as a function. Maybe do a custom build of Vim with some other language enabled, since it can use Python and I really want to see someone use an all Python .vimrc because that would be hilarious.

  • @joseluiscruz8183
    @joseluiscruz8183 6 หลายเดือนก่อน

    Is this a video about Emacs or about Vim?

  • @muddyexport5639
    @muddyexport5639 11 หลายเดือนก่อน

    Excellent! This is the reason I keep viewing your posts. Not a fan of the non-tech but that is the nerd in me. 1st Amendment Rants are fine by me but I'll watch the tech and skip any other.

  • @matematleta492
    @matematleta492 6 หลายเดือนก่อน

    Why use a plugin when it is easier just to set a keybinding for this?

  • @samoylov1973
    @samoylov1973 11 หลายเดือนก่อน +6

    dawwP
    in vim (for swap forward and it doesn't matter where you are in the first word)
    dawbP
    (for backward swap)
    Vim - rocks!

    • @bigmikeobama5314
      @bigmikeobama5314 11 หลายเดือนก่อน +2

      nuh uh! emacs rocks!
      (i dont use either one, or any program like it either)

    • @anon_y_mousse
      @anon_y_mousse 11 หลายเดือนก่อน

      Backwards doesn't deal with spaces correctly if you're on the last word on a line. I've never had a need for these, but I don't do any novel writing type things, mostly just writing code and the occasional readme file.

  • @ZeStig
    @ZeStig 11 หลายเดือนก่อน +2

    Common Emacs W

  • @adjusted-bunny
    @adjusted-bunny 11 หลายเดือนก่อน +2

    I tried the transpose function: myself: "dt Trump sucks." After transposing "Trump" and "sucks" I get: "dt sucks Trump." Emacs is awesome!

  • @Winnetou17
    @Winnetou17 11 หลายเดือนก่อน

    Interesting. Hate to burst the bubble a bit, but the line up/down transposition exists in Notepad++ (and I guess notepadqq), and maybe even EditPlus 2 that I've used more than a decade ago. Ctrl+Shift and up or down arrow. Using this for over a decade feels so weird to see DT so happy and something so novel for him. Notepad++ doesn't seem to have the word/selection left/right transposition though. But I never felt like I needed it so... meh. Maybe it has it and I just don't know it because I didn't search for it.
    Still, the best features for both Emacs and (Neo)vim is that you can have not just custom bindings but custom code/functionality made and tailored exactly how you want it. They're basically Macros++ (I guess Emacs would be Macros#. Or should it be the other way around ?)

    • @dkosmari
      @dkosmari 11 หลายเดือนก่อน +1

      Macros aren't a feature of Emacs, they're Emacs itself. It's even how it got its name.

    • @Winnetou17
      @Winnetou17 11 หลายเดือนก่อน

      @@dkosmari Ha, didn't knew that. But I'm not surprised.

  • @cry0xen
    @cry0xen 11 หลายเดือนก่อน +2

    Emacs is overrated. An os should do more than this.😅😅😅

  • @akojic5486
    @akojic5486 11 หลายเดือนก่อน

    👏🏻👏🏻👏🏻

  • @gustavbruhn2581
    @gustavbruhn2581 11 หลายเดือนก่อน

    Can you please make a video on hyprland?

  • @user-zn3zx6fk7u
    @user-zn3zx6fk7u 11 หลายเดือนก่อน

    first

  • @wolandsmachine
    @wolandsmachine 11 หลายเดือนก่อน +4

    Useless and redundant emacs nonsense.
    in Vim:
    swap char => xp || xP
    swap line => ddp || ddkP || ddkp
    swap words => dawwP || dawelp || dawbP
    there are many more ways to achieve these, including visual mode commands and custom mappings or ex commands.
    The great thing about vim is that it is a language for editing text not just a set of macros, once you speak the language you can achieve anything.

    • @dkosmari
      @dkosmari 11 หลายเดือนก่อน +1

      Smartest vim user right here.

    • @hdbrot
      @hdbrot 11 หลายเดือนก่อน +1

      What‘s the difference to emacs? It‘s also a programming language and when you know the language, you can achieve anything.

    • @wolandsmachine
      @wolandsmachine 11 หลายเดือนก่อน +1

      emacs is not a programming language. lisp is, and that is irrelevant. Vim's text editing model is a language of its own that expresses how text should be manipulated. I didn't say its a programming language.
      Hope that helps. @@hdbrot

    • @hdbrot
      @hdbrot 11 หลายเดือนก่อน

      @@wolandsmachineMy "is" should be understood as "is completely controlled by" and you said "The great thing about vim is that it is a language", so you did the same.

    • @wolandsmachine
      @wolandsmachine 11 หลายเดือนก่อน +1

      Vim is a language != vim is a programming language. That should be obvious, and it differs emacs since emacs does not have the same notion on text editing that vim or vi does. Vim's language is far more sophisticated than memorizing shortcuts and calling macros, since you can even do that in ms-word. Vim's language follows a grammar of its own and by using it you are able to construct edits/macros/motions that would be impossible otherwise. @@hdbrot