a technical notebook
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB

  1. Friday, December 5, 2014
  2. ========================
  3. notes on vim
  4. ------------
  5. Vim is a text editor. My slowly-evolving configuration can be found on GitHub,
  6. in [bpb-kit][bpb-kit].
  7. [Tyler Cipriani][thcipriani] is a lot smarter than I am about vim (and, in
  8. fact, most things), but I am particular and don't always share his preferences.
  9. keybindings
  10. -----------
  11. I'm starting in on this notebook, which uses a Makefile, and think it might be
  12. nice to have a quick vim keybinding for `:make`. I would use `F5`, by analogy
  13. to QBasic, but I've already bound that to `:wall`, which writes all the open
  14. buffers with changes.
  15. I think that maybe `<leader>m`, which in my case means `,m`, would be ok. Then
  16. I'm not sure if something is already mapped starting with that, so I try `:map`.
  17. I want to search through the list produced by `:map`, and think it'd be nice if
  18. I could just read it into a buffer. The first thing I google is "vim read
  19. output of command into file". This could easily enough give hits for reading
  20. the output of a shell command, but the 3rd thing down the page is
  21. [Capture ex command output](http://vim.wikia.com/wiki/Capture_ex_command_output)
  22. on the Vim Tips Wiki.
  23. There are a bunch of interesting ideas there, but the first basic idea is this:
  24. :redir @a
  25. :set all
  26. :redir END
  27. Then you can open a new buffer - `:new` - and do `"ap`. This says "using the named
  28. register a, paste".
  29. This seems to work with `:set all`, but not so much with `:map`. Why not? I skim
  30. `:help map` and `help redir` without getting very far. Updates to come.
  31. With that digression still unanswered, the mapping I settled on is simple:
  32. nmap <leader>m :make<CR>
  33. I never know if these are going to take with me. The handful of custom
  34. bindings that have actually entered my vocabulary are super-useful, but more
  35. often than not I wind up forgetting about an idea not long after I've
  36. implemented it.