Earlier quoted context omitted.
I am developing a headache now, after trying this out, because I'm remembering all the times I have done this by hand. Or even writing an awk script, etc.
hm, I just select the text and do xclip -o | awk '{ print "\"" $0 "\"," }' find it simpler than 10 lines of lisp but what do I know :p
My Emacs Productivity Tricks/Hacks
161–170 of 210 posts
Re: My Emacs Productivity Tricks/Hacks
#162The one thing I consistently do in emacs that shocks my coworkers -- is running this (custom) function, that I call "arrayify": (defun arrayify (start end quote) "Turn strings on newlines into a QUOTEd, comma-separated one-liner." (interactive "r\nMQuote: ") (let ((insertion (mapconcat (lambda (x) (format "%s%s%s" quote x quote)) (split-string (buffer-substring start end)) ", "))) (delete-region start end) (insert in…
In vim: :' !awk '{printf("\"\%s\", ",$0)}' or to do the whole file: :%!awk '{printf("\"\%s\", ",$0)}' What I find nice about this approach is that I can use my knowledge of awk in other non-vim contexts. Similarly I can use my knowledge of other text processing commands to do things in vim, like reformat text into columns (:%!column -t) for example. Of course you could use vim commands to do the same thing: 0 GI" $ G…
Re: My Emacs Productivity Tricks/Hacks
#163This is mostly a listing of packages and very known ones at that. One of the best features I like is undoing regions. That is, if you know the approximate location of the text that you want to undo, you just select a region that contains that location and call undo. It can be used as a quick git alternative. Say you modify the buffer all over the place. If you want to undo some text that you've modified an hour ago b…
Yasnippet is amazing. Being able to tab through different fields is a game changer. You could make a snippet for every lisp function and never have to enter a paren ever again! The only probablem is that yasnippet can’t handle multiple nested expansions: it only keeps track of the current expansion.
Re: My Emacs Productivity Tricks/Hacks
#164Another beautifully designed piece of Emacs software is magit, where the defaults are extremely sane. The package is self-documented and you can learn it all by typing ? anytime. Being able to git log the file you are in is also a huge plus.
Magit made me a better programmer. Learning `git` proper would probably be as good (and certainly get more street cred), but magit was more accessible and more fun to use since I was already emacs-proficient.
Re: My Emacs Productivity Tricks/Hacks
#165Earlier quoted context omitted.
All decent IDEs have a file search command.
Somehow my colleagues who use VS Code or JetBrains IDEs don't manage to learn about those features while all of my vim-using colleagues somehow do. (Haven't worked with anyone using Emacs yet)
Is there anything free that even begins to approach the quality and accuracy of the JetBrains Rust analysis plugin? If so, I’d love to know about it and start using vim.
Re: My Emacs Productivity Tricks/Hacks
#166I use Emacs every day. But only for org-mode which is fantastic. Besides that I really really tried hard to love Emacs as my go-to editor. However I found no alternative for decent CSV file support (like https://github.com/chrisbra/csv.vim simply great!) Inspecting large XML files with syntax highlighting and folding. VIM is also not the fastest here but at least 10 times faster (emacs SGML mode is a joke for xml fil…
csv-mode does exactly what you want.
Deleting a Row?
Easily navigating from the nth element in a CSV header to the nth element in data row 1000?
Re: My Emacs Productivity Tricks/Hacks
#167One of my favorites is creating a separate backup dir where all backup "~" files are created and versioned and rotated in and out etc at specific intervals, so I no longer get the random files in the dir I'm working in but can still go find backups if I mess something up. (setq backup-by-copying t backup-directory-alist '((".*" . "~/.emacs.d/bu/")) delete-old-versions t kept-new-versions 6 kept-old-versions 2 version…
I already use this in my shrc files: alias ls='ls --hide="lost+found" --hide="#*" --hide="*~" --hide="*.pyc" --hide="*.egg-info" --hide="__pycache__" --color=auto' But I'll be adding your item into my config for the rotated versioning, I wasn't aware that emacs does that but I assume it'll save me anything from few hours to a few weeks yearly. Thanks!
Re: My Emacs Productivity Tricks/Hacks
#168Earlier quoted context omitted.
Well one major thing is that tramp is inside emacs so you can configure it with elisp, which is a major plus in my mind. The main problem with tramp is that Emacs is single threaded (and elisp threads run one at a time), so networking operations can be iffy. On most normal connections it works fine in my experience. Another reason to use sshfs is if you're switching between Emacs and a separate terminal, you don't ne…
By vterm do you mean this? https://github.com/akermu/emacs-libvterm/blob/master/README.... It seems extremely experimental, and I've been trying recently to make my emacs more stable so I can choose when I want to spend time editing my config.
Re: My Emacs Productivity Tricks/Hacks
#169Earlier quoted context omitted.
Once you bind it to a key, though, it's a lot quicker. There is something to be said for emacs as a unified computing environment when compared to the UNIX way of doing things. Instead of wrangling different parts of the filesystem and tying them together with aliases and shell scripts, you can just version-control the productivity software (i.e. your emacs config) you write in the course of using emacs.
I'll be that guy ;) In vim/unix you can run this command (keybinding not included but simple enough): :' %!awk 'BEGIN {ORS=" "} {print "\" $1 "\"," } As for a unified computing environment, it is unified with the OS and not a world unto itself, there is no need to have one way of doing things within the editor and another if you want to script something. Both work just as well with version control, plus it gives you…
Alias emacs=‘vim’
:)
Re: My Emacs Productivity Tricks/Hacks
#170Earlier quoted context omitted.
Emacs keyboard macros can easily operate on thousands of things. Just give it a prefix argument like C-u 1000 .
Or use the C-u 0 prefix to repeat till there is an error, possibly at the end of buffer. And if you don't want to go on to the end of the buffer, narrow to the required region (C-x n n) and widen afterwards (C-x n w).