3 ms·
Sublime is perfect example of extremely well (almost perfectly, for me personally it is) executed native desktop multi-platform app! I payed even if I use it to
by Philipp__ 9y ago
Sublime is perfect example of extremely well (almost perfectly, for me personally it is) executed native desktop multi-platform app! I payed even if I use it today mostly for reading the code, since Vim and Emacs took over writing code.
- Skunkleton 9y agoThat is interesting. What makes Vim better for writing, but not reading in your workflow?
- Philipp__ 9y agoWell I use Vim more for navigation and skimming around, or reading when I know where I am going. But for opening for example Redis source just wanting to read the source code and learn, I still like Sublime the best for that, it is so smooth and nice looking. Reading source code in Sublime really is a pleasure. Emacs on the other hand provide very nice integration with various REPLs and functional languages have best tooling in it. Vim I use as terminal editor, and when I do work inside repo, reading diffs and programming in some languages (like C for example). I really want to switch to only one editor, but whenever I try, I come to the point where I miss the feature of some other one of these 3. : ) I'm bit too weird when it comes to editors and configs...
- Skunkleton 9y agoYeah, I agree with Sublime being super nice to look at and smooth. While I don't use it much anymore, I am still happy that I bought a license.
- haspok 9y ago1. Open source code 2. See definition of a function - copy name of function 3. Open new folder -> say 2 folders above the current file 4. Right click -> Find in Folder, paste name of function, enter 5. Get an overview with: - a list of files where the function name is found - for each line the surrounding code is also shown - double clicking on a filename opens said file in a new tab I have yet to find any vim/emacs tool that can do this so easily and effortlessly. Even with Emacs Projectile, you have to define a "project"? And then grep in that (but the user interface is just subpar). Maybe I'm missing something, but for me, this is effectively stopping me using Vim/Emacs most of the time. I use Vim for editing individual files, but anything more than that, it is either IDEA (ok, I do Java dev a lot, so that's a must), or any Commander clone (which has a Find functionality).
- Skunkleton 9y agoSo I don't want to tell you to change your workflow. Like most things that evolve over time, they are the way they are for good reason. No one way is better than another. That said, here is how I do what you described above in Vim. There are a few components: 1) Some fancy keybindings, 2) A plugin, and 3) an optional wrapper script for launching commands inside a git project. First, keybindings. You know about '#' and '*' in vim that search for the next occurrence of token under your carat? I have an additional binding that does the same, but doesnt move the carat. I bind it to <CR> (Enter), but you could bind it to whatever. If you bind it to <CR>, it will interfere with the minibuffer, which requires some shenanigans to work around (see the vimrc) nnoremap <silent><CR> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> This is nice for a few use cases. One, it is nice to see where a token is used in the current file, and two, it puts the highlighted word into a register, that you can later paste. I use mhinz/vim-grepper to execute searches, with my vimrc I can move the carat to the word I am interested in, press "enter", then type :Gr<TAB><ENTER> which will put me into grepper. Then I can press ^R/ (that is ctrl-r then /) which pastes the content of the '/' register. Grepper will then launch the selected search tool (ag, grep, git grep) and create a mini buffer of matches that you can click on, or highlight and press enter. Here is my vimrc if you want to give it a go. BE WARNED the first line of the vimrc calls git clone, if this is bad on your setup for some reason, dont use my vimrc. https://gist.github.com/SeamusConnor/d7ebb747c91845055e069f0c62d0e713 https://gist.github.com/SeamusConnor/d7ebb747c91845055e069f0... The last piece is executing the search from the correct directory, to do that, I use two methods. First, vim has a built in way to change its working directory (:chdir), so you could do a :chdir ../../. Second, if you are using git it is nice to run commands at the top level of the git directory sometimes. For that I have a script that translates commands from the CWD to the git top level. Some things you can do with it: Rebuild cmake style project: g make -C build && g ./build/my_program # you can execute this from anywhere inside the repo Open a file inside vim: cd src/my/nested/folder/ g vim my_source_code.cpp # open vim at git top level directory, and translates the file to src/my/nested/folder/my_source_code.cpp https://gist.github.com/SeamusConnor/645b66faff12ad5dbe3747fe2fcf63ef https://gist.github.com/SeamusConnor/645b66faff12ad5dbe3747f... Anyway, hope that helps you or someone else.
- 9y ago