4 ms·
At my job we use tabs, but elsewhere I've always used spaces. Rather than installing yet another plug-in, I use a Vim autocmd that checks to see whether I'm in
by wincent 8y ago
At my job we use tabs, but elsewhere I've always used spaces. Rather than installing yet another plug-in, I use a Vim autocmd that checks to see whether I'm in a company repo, and if I am, it applies some overrides.
Links:
- Autocmd that runs on relevant filetypes: https://github.com/wincent/wincent/blob/db33e22c1/roles/dotfiles/files/.vim/plugin/autocmds.vim#L61 https://github.com/wincent/wincent/blob/db33e22c1/roles/dotf...
- Function that detects a work repo: https://github.com/wincent/wincent/blob/db33e22c1/roles/dotfiles/files/.vim/autoload/wincent/liferay.vim#L5-L26 https://github.com/wincent/wincent/blob/db33e22c1/roles/dotf...
- Function that finds nearest Git directory: https://github.com/wincent/wincent/blob/db33e22c1/roles/dotfiles/files/.vim/autoload/wincent/git.vim#L1-L15 https://github.com/wincent/wincent/blob/db33e22c1/roles/dotf...
- Function that applies overrides: https://github.com/wincent/wincent/blob/db33e22c1/roles/dotfiles/files/.vim/autoload/wincent/autocmds.vim#L182-L202 https://github.com/wincent/wincent/blob/db33e22c1/roles/dotf...
(Disclaimer: like most things in my dotfiles repo, overengineering level 99.)
- mruts 8y agoAm I the only who thinks that vimscript is truly awful and much inferior to Elisp?
- TeMPOraL 8y agoAs much as I like Elisp - does this matter in this context?
- mruts 8y agoI guess not. Just a thought I suppose.
- wincent 8y agoHaving written quite a bit of vimscript, I can confirm for you its true awfulness.
- grandep 8y agoWhat makes you say this? I don't necessarily _love_ Vimscript but it's a fairly straightforward imperative language. I also never understood why so many people rave about Elisp.
- mruts 8y agoI mean, Elisp isn’t the greatest as languages go, but it’s really nice actually (compared to all the other languages that you use to script editors). The joke that everyone makes about emacs is “it’s an operating system with an editor on top” is actually 100% true. Emacs is built on top of Elisp, which is a testement to it’s power. From your comment, it sounds like you’ve never used emacs/elisp. Why don’t you give it a try? With evil-mode, you don’t even have to give up your vim keybindings! Emacs is the most configurable and powerful editor in existence, and that’s not an opinion, it’s a fact. PS: I actually use Intellij for my day to day scala work, but emacs is still the best (given enough time to configure/program the way you want).
- grandep 8y agoI actually did try Emacs for a while for exactly the reasons you point out. I heard how great it was and wanted to see for myself what all the fuss was about. I used it exclusively for a few months and gained some familiarity with Elisp, but eventually ended up going back to Vim (for a variety of reasons that I'll not get into here). In my experience Vimscript is "easier" in the sense of going from an idea of something I want to do to actually implementing it. Even after using Emacs + Elisp for all that time, I never experienced that transcendental moment that so many fans of Lisp dialects seem to share.
- bencoveney 8y agoGit has a mechanism for getting the root repo directory - `git rev-parse --show-toplevel`
- wincent 8y agoTrue. I guess I wanted to avoid shelling out, but it probably wouldn't hurt.