aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-09-21ftplugin/mail.vim: Add bindings to add and remove the 'a' format optionTeddy Wing
I've been editing email headers in Vim recently (previously I only did that in Mutt's line editor). With automatic formatting, the headers can get messed up due to reflow. Add bindings so we can quickly disable automatic paragraph formatting when we need to.
2021-09-21vimrc: Add `<C-w>N` to open a new empty buffer in a vertical splitTeddy Wing
Like `<C-w>n` except that instead of opening a new buffer in a horizontal split, it opens a vertical one. This can be preferred depending on the existing window layout.
2021-09-05Add 'mpvim' plugin @ 513c455d5a902fff2b38edf86abc15c36688bf85Teddy Wing
Provides syntax highlighting for MacPorts Portfiles. This code was copied from the 'macports-contrib' repository (https://github.com/macports/macports-contrib) at commit 513c455d5a902fff2b38edf86abc15c36688bf85 (https://github.com/macports/macports-contrib/tree/513c455d5a902fff2b38edf86abc15c36688bf85). The Vim plugin lives in a subdirectory of the 'macports-contrib' repository, so I'd have to include a whole mess of files that don't relate to Vim if I wanted to add the plugin as a submodule. I'd just as soon not have to copy the files into my repository tree like this, but it's better than adding a non-Vim submodule. Assuming it's okay to add these files to my repository, as the port file for this plugin describes it as being BSD licensed: https://github.com/macports/macports-ports/blob/12d7b1597bef875058758c9c587b7593f39a5af1/editors/mpvim/Portfile Unfortunately, there's no BSD license or copyright notice included in the plugin code. But I'm going to assume I'm allowed to redistribute it.
2021-08-29projects/aodocs.vim: Use the current date in new TODO entryTeddy Wing
When creating a new TODO entry, always use the current date instead of incrementing the final 'day' segment with <C-a>. That would cause issues when incrementing from "07" (results in "010" instead of "08" because it assumes it's in octal), and "08" (results in "9" without a leading zero, though I'm not sure why).
2021-07-18ftplugin/objc.vim: Switch to tab indentation in Objective-CTeddy Wing
I've gone back and forth between tabs and 4-space indentation in Objective-C. Currently working on a project that uses tab indentation so sticking with that for now.
2021-03-20ftplugin/lisp.vim: Activate the built-in Lisp ftpluginTeddy Wing
I wanted the built-in `comments` setting to automatically insert the comment leader when wrapping.
2021-02-19ftplugin/lisp.vim: Set <LocalLeader> to <Space>Teddy Wing
Vlime includes a bunch of mappings, but some of them are shadowed by own mappings. The plugin doesn't include any corresponding ex-style commands. Change the <LocalLeader> in Lisp files to <Space> to give me access to all of Vlime's mappings.
2021-02-19Add ftdetect/lisp.vimTeddy Wing
Detect ASDF *.asd files as Lisp files.
2021-01-26Add ftdetect/objc.vimTeddy Wing
Manually set `.m` and `.mm` files to Objective C. By default these were set to `matlab`.
2021-01-26Add ftplugin/lisp.vimTeddy Wing
Add Common Lisp indentation settings.
2021-01-26Add 'vlime' pluginTeddy Wing
Use Vlime instead of Slimv for a Common Lisp environment.
2021-01-26Remove 'slimv' pluginTeddy Wing
Haven't been using this plugin. Recently started a Common Lisp project, but am going to use Vlime instead, which seems to integrate better with user configuration.
2021-01-26git-blamer: Add `-M` flag to `git-blame` callTeddy Wing
Don't change the author for moved lines.
2020-10-27vimrc: Make the `<leader>p` command repeatableTeddy Wing
Allow us to repeat system pasting using `.`.
2020-10-21Add 'buffer-delete' pluginTeddy Wing
I was having trouble with slow `<C-p>` completion, and figured out it was due to the fact that I had about 300 buffers open. Many of these buffers weren't being actively used, and were just loaded in from Vim sessions past. When I removed the unloaded buffers, completion sped up like a whistle. Thanks to 'sidyll' (https://stackoverflow.com/users/557306/sidyll) on Stack Overflow for explaining how to get "all" buffer numbers (or at least all possible buffer numbers up to the highest one open), as well as the filtering logic: https://stackoverflow.com/questions/17931507/vimscript-number-of-listed-buffers/17933352#17933352 I leveraged the above to get the buffer numbers of all unloaded buffers, then delete the buffers by number. It was originally a temporary command-mode line, but I decided it could be beneficial to save the code just in case I need it again.
2020-10-21vimrc: Turn off `g:go_code_completion_enabled`Teddy Wing
I was having trouble with completion and I have a feeling that this setting is confusing things.
2020-10-21vimrc: Make the `gS` command repeatableTeddy Wing
Allow repeating the ArgWrap mapping via 'repeat.vim' to make it even easier to use.
2020-10-13vimrc: Replace `t` cabbrev with `T` command aliasTeddy Wing
Alias `T` to `TComment` instead of using a cabbrev. The abbreviation would mess up commands with "t" in them, like turning `tjump` into `TCommentjump`. Replace the abbreviation with a new `T` command that acts as an alias for `TComment`. I didn't include argument completion because I don't use that. Otherwise, replicate the `TComment` command's definition and pass all parameters to it. This gives us a short alias for commenting, and `T` is the first completion with `:t<Tab>`.
2020-10-04Update 'vim-grappele' to v0.3.0Teddy Wing
Adds operator-pending and visual mode mappings.
2020-10-04ftplugin/vim.vim: Activate the built-in Vim ftpluginTeddy Wing
I was bemoaning the lack of `fo+=c` in Vim files, so decided to look over the contents of `$VIMRUNTIME/ftplugin/vim.vim`. Since I didn't find anything there that wasn't to my liking, I decided to activate the whole ftplugin.
2020-10-04ftplugin/typescript.vim: Make `gf` open `index.ts` if path is directoryTeddy Wing
In TypeScript and Node.js, you can import a file `./directory/index.ts` by importing `./directory`. I wanted `gf` and friends to open the `index` file if the import refers to a directory. By default, `gf` opens the directory using Netrw. At first tried to do this by setting 'includeexpr' as follows: setlocal includeexpr=<SID>FindFile(v:fname) function! s:FindFile(fname) echom 'FindFile: ' . a:fname if filereadable(a:fname) return a:fname endif return a:fname . '/index' endfunction This gave me the following error: E120: Using <SID> not in a script context: <SID>FindFile so I tried removing `<SID>`: setlocal includeexpr=FindFile(v:fname) function! FindFile(fname) echom 'FindFile: ' . a:fname if filereadable(a:fname) return a:fname endif return a:fname . '/index.ts' endfunction The problem was, my 'includeexpr' function wasn't getting executed every time I used `gf`, only some times. And it never ran when I used `gf` on a directory. After asking on Freenode#vim, 'crose' made the following suggestion: augroup typescript_maybe_append_filename au! au BufEnter * if expand('<amatch>')->isdirectory() \ | call s:maybe_append_filename() \ | endif augroup END fu s:maybe_append_filename() abort if getbufvar('#', '&ft', '') == 'typescript' exe 'e ' .. expand('%:p') .. 'index.ts' endif endfu This works, but it adds the Netrw directory buffer to the jumplist, and feels more like a mitigation than a solution. I looked at the following language ftplugins for inspiration: * .../vim/8.2.1650/share/vim/vim82/ftplugin/ruby.vim * https://github.com/moll/vim-node/blob/master/autoload/node.vim These prompted me to override `gf` with a custom mapping since it looked like 'includeexpr' wasn't going to be the right tool for this. The `s:FindFile()` function has similar logic, but is now written as a map rhs function, taking into account the different ways of invoking `gf`. When defined as a script-local function, I at first kept getting this error using `gf` on a directory: E127: Cannot redefine function <SNR>111_FindFile: It is in use Thanks to Ingo Karkat (https://stackoverflow.com/users/813602/ingo-karkat) and this Stack Overflow answer which describes how to keep the function in the same file (so I didn't have to move it to an autoload function) and still prevent it from being redefined: https://stackoverflow.com/questions/22633115/why-do-i-get-e127-from-this-vimscript/22633702#22633702 I needed to prepend `<C-v>` to the `<C-w>` characters in the map function calls because these would actually run in the command line, deleting the preceding word, and messing up the mapping. In order to pass those `<C-w>` characters in the string arguments, I needed to escape them with `<C-v>`, even though it resulted in non-obvious looking code.
2020-09-28vimrc: Add `<leader>db` mapping to open files with TBuffer using PickTeddy Wing
I've been using my `TBuffer` command recently, but don't like how I have to type out parts of the file name interspersed with "*"s, and press `<Tab>` to ensure I'm getting the right file in case there are multiple matches. Make it easier to use `TBuffer` by allowing fuzzy finding with Pick. This allows us to filter the list of buffers, choosing one to pass to `TBuffer`. Used the buffer list because the function is readily available, and because there's no easy way to get a list of all buffer names in all tabs. I'd probably have to map over `gettabinfo()`, and get the buffer name for each window. Or manually filter the `:tabs` output. Chose `db` because `dt` is taken for opening a file in a new tab, and the word "tab" ends in "b". Now that I think about it, though, this command deals with buffers, so it probably makes more sense to put it under the "b" namespace.
2020-09-23projects/aodocs.vim: Add `htodo` abbreviation to insert JSDoc TODOTeddy Wing
Make it easier to insert reminder comments to write a JSDoc block.
2020-09-22vimrc: Add i_^r^f mapping to insert the current filenameTeddy Wing
Since this removes the path and extension, it makes it easier to use than `<C-r>%` when I want to insert a title or symbol based on the file's name.
2020-09-18plugin/abbreviations.vim: Add cabbrevs for T-prefixed commandsTeddy Wing
I used to be able to type: :59-63T<Tab><Enter> to comment out a block. Now, since `TBuffer` is earlier alphabetically than `TComment`, the above no longer works. Add two command line abbreviations to make it easier to use these two commands.
2020-09-13vimrc: Set a fixed tall quickfix window height for vim-goTeddy Wing
By default, vim-go sets the quickfix window's height to be the number of quickfix items. This is problematic when, for example, there's a single error item, and the quickfix window opens below a narrow window (for example, in one of three vertical splits). In that case, the error gets line wrapped, and quickfix window is only one line tall, meaning I can't read the full error. Set the window height to Vim's default of 10 lines. Vim-go will collapse the height to 10 lines if the variable is set to a number greater than 10, and 5 lines was too short in practise.
2020-09-07projects/aodocs.vim: Use camel case for Go struct tagsTeddy Wing
AODocs JSON uses camel case, so this seems like a sensible default.
2020-09-07ftplugin/go.vim: Run shell tests with verbose flagTeddy Wing
In case I need to add logs for debugging.
2020-08-31ftplugin/go.vim: Create test file on alternate if it doesn't existTeddy Wing
When switching to a file's alternate (its test file), create the test if the file doesn't exist. By default, a warning is issued if the file doesn't exist. I wanted an easier way to create the test file. Previously I'd use: :e %:h<Tab><C-f>bbi_test<CR> This uses the function that the `Plug` mappings call under the hood, and turns on the `-bang` argument to have it create the test file if it doesn't exist.
2020-08-02ftplugin/rust.vim: Fix spacingTeddy Wing
2020-08-02ftplugin/rust.vim: Add mapping to run testsTeddy Wing
2020-07-27ftplugin/go.vim: Add mapping to run package tests with terminal outputTeddy Wing
The Vim-Go mappings run the tests in a job and add results to the Quickfix list. Add a new mapping that doesn't use Quickfix, and instead just runs the test command for the package that contains the current file, outputting the results to standard output. Gives me an additional alternative to view test results.
2020-07-19ftplugin/rust.vim: Add a command to run `cargo check`Teddy Wing
Faster than using `cargo build` for a feedback cycle.
2020-07-19Add after/ftplugin/rust.vimTeddy Wing
Fix bugs introduced by activating the Rust Vim plugin's ftplugin.
2020-07-19ftplugin/rust.vim: Activate Rust plugin's ftpluginTeddy Wing
Take advantage of the Rust Vim plugin's additional language-specific features, like `///` and `//!` comment handling.
2020-07-17ftplugin/rust.vim: Add mappings to build and runTeddy Wing
2020-07-17ftplugin/rust.vim: Turn on `b:argwrap_tail_comma`Teddy Wing
Rust style seems to prefer trailing commas.
2020-07-17Add ftdetect/hcss.vimTeddy Wing
Highlight Hasp files as CSS.
2020-07-04projects/aodocs.vim: Set 'path' for UFO extension projectTeddy Wing
Enable `gf` and related commands to work by setting the proper 'path', and ensuring the `.js` suffix is used on files.
2020-06-20vimrc: Add count support to `[q`, `]q`, `[w`, `]w`Teddy Wing
Allow these next/previous mappings for the quickfix and location list to take counts.
2020-06-15ftplugin/python.vim: Turn on `b:argwrap_tail_comma`Teddy Wing
Append a trailing comma when unwrapping arguments.
2020-06-15Add 'vim-tbuffer' pluginTeddy Wing
2020-06-15ftplugin/go.vim: Add `Ze` mapping to insert `if err` blockTeddy Wing
Vim-Go has a `:GoIfErr` command, which inserts an `if err != nil` check. Add a mapping for it to make it quicker to access.
2020-06-13colors/twilight256.vim: Highlight comments in a lighter grey colourTeddy Wing
I've been having some trouble reading comments, as the grey is rather low contrast. To improve readability, change the highlight colour to a lighter grey, increasing contrast.
2020-06-01ftplugin/go.vim: Turn on `b:argwrap_tail_comma`Teddy Wing
This adds a trailing comma when using ArgWrap. Go requires trailing commas, otherwise it reports compilation errors.
2020-05-08projects/aodocs.vim: Add mapping to copy the last TODO entryTeddy Wing
I've been keeping a daily to-do list. Every day, I copy yesterday's entry and use it as today's with some modifications. Add a mapping to automate copying the previous day's entry.
2020-05-08ftplugin/typescript.vim: Set 'commentstring'Teddy Wing
2020-05-08Add 'typescript-vim' pluginTeddy Wing
The JavaScript plugin I'm using does an okay job syntax highlighting TypeScript, but some identifiers don't get highlighted. Now that I'm doing a project in TypeScript, it's nice to have everything highlighted correctly.
2020-04-29colors/twilight256: Remove underline on current line numberTeddy Wing
After upgrading to Vim 8.2, an underline was added to the line number of the current line. Remove this with `CursorLineNr` to restore the look from before the upgrade.
2020-04-24projects/aodocs.vim: Add SCSS and TypeScript indentationTeddy Wing