aboutsummaryrefslogtreecommitdiffstats
path: root/ftplugin
AgeCommit message (Collapse)Author
2023-12-06ftplugin/typescript.vim: Add compile mappingTeddy Wing
2023-12-01ftplugin/typescript.vim: Add debugger mappingsTeddy Wing
2023-11-06ftplugin/typescript.vim: Add 'prettier' formattingTeddy Wing
Set up formatting for the current buffer using 'prettier'.
2023-08-03ftplugin/python.vim: Use consistent debugger mappingsTeddy Wing
I added these mappings before I developed a set of consistent cross-language build, test, etc. mappings. Re-use the mappings I came up with for adding a debugger line in Ruby. These are much easier to type than the current Leader commands.
2023-07-18ftplugin/ocaml.vim: Add `dune promote` bindingTeddy Wing
2023-07-18ftplugin/ocaml.vim: Add test bindingTeddy Wing
2023-07-18ftplugin/ocaml.vim: Add build and run mappingsTeddy Wing
2023-07-18ftplugin/ocaml.vim: Add indentation settingsTeddy Wing
All the OCaml code I've read so far uses two-space indentation.
2023-04-25ftplugin/java.vim: Set TComment commentstring to '// %s'Teddy Wing
By default it's '/* %s */' which I don't like for line comments.
2022-05-22ftplugin/go.vim#s:GoDoc: Start at the top of the documentationTeddy Wing
Previously, the cursor would be at the bottom or the loaded documentation. It's more practical to start at the beginning. Also remove the empty first line.
2022-05-22ftplugin/go.vim#s:GoDoc: Change filetype to 'godoc'Teddy Wing
Get 'godoc' syntax highlighting.
2022-05-22ftplugin/go.vim#s:GoDoc: Remove unnecessary `|` in Ex commandsTeddy Wing
These were a holdover from when the lines were in a map binding. They're unnecessary now that they've been moved to a function.
2022-05-05ftplugin/go.vim: Allow `:GoDoc` to work with `<cword>`Teddy Wing
This re-enables `K` keyworkprg functionality for the `GoDoc` command, this time using my custom version.
2022-05-05ftplugin/go.vim: Add `GoDoc` commandTeddy Wing
Override the `GoDoc` command from 'vim-go'. That one produces docs without the "-all" flag, and there's no option to enable "all". This gives me all the documentation for a package. This isn't as useful yet, as it breaks the `K` keywordprg.
2022-03-07ftplugin/go.vim: Add 'formatoptions' for comment leadersTeddy Wing
2021-11-15ftplugin/todo.vim: Add `<Space>` as an additional LeaderTeddy Wing
Provide the option to use a `<Space>` as a leader in addition to my normal Leader, since it can be quicker for some commands.
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-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-01-26Add ftplugin/lisp.vimTeddy Wing
Add Common Lisp indentation settings.
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-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-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-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-15ftplugin/python.vim: Turn on `b:argwrap_tail_comma`Teddy Wing
Append a trailing comma when unwrapping arguments.
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-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-08ftplugin/typescript.vim: Set 'commentstring'Teddy Wing
2020-03-25ftplugin/todo.vim: Highlight `todoUnimportant` as a light greyTeddy Wing
These are by default highlighted as `Ignore`, which makes them the same colour as finished and deleted to-dos. Set them to a light grey colour to make them more readable.
2020-03-12ftplugin/go.vim: Add a mapping to open the alternate file in a splitTeddy Wing
2020-02-26ftplugin/go.vim: Add mapping to show alternate fileTeddy Wing
Use `z<C-^>` to swap between test and implementation files. Gives me a faster way to navigate.
2020-02-26ftplugin/go.vim: Enable the vim-go ftpluginTeddy Wing
Enable extra mappings, text objects, etc. provided by vim-go. Wanted function scoped motions and text objects, and this was the easy way to get them.
2019-11-04Add ftplugin/javascript.vimTeddy Wing
Add bindings to insert `debugger` statements in JavaScript.
2019-10-21Remove ftplugin/gitcommit_pullreq_editmsg.vimTeddy Wing
Now that I effectively removed the `checktime` augroup in cc86bdf4af5212a3b2a7960e65c402eac71091c1, this is no longer necessary. Also, it errors because `checktime` no longer exists.
2019-09-26ftplugin/go.vim: Change `<leader>cf` mapping to `<leader>cd`Teddy Wing
This mapping conflicted with the `<leader>cf` mapping in my `vimrc` that copies the current filename/relative path to the clipboard.
2019-08-01ftplugin/netrw.vim: Remove `nowrap` from `g:netrw_bufsettings`Teddy Wing
This seemed to cause files I opened with Netrw to have `set nowrap`, overriding the `set wrap` I have in my vimrc.
2019-07-21Add ftplugin/gitcommit_pullreq_editmsg.vimTeddy Wing
Disable 'better autoread' for PULLREQ_EDITMSG files. GitHub's `hub` CLI may be doing some polling on the file or something because I keep getting prompts to "Load file" after a while when writing pull request descriptions.
2019-06-20Add ftplugin/lua.vimTeddy Wing
* Set 'commentstring' * Fix comment wrapping by adding `--` to 'comments'. Otherwise no leading comment markers would be inserted when text wrapped to the next line.
2019-06-17vimrc: Don't preserve indentation on empty linesTeddy Wing
Over the years and as I've been using Vim, I've gradually stopped liking this style, and now prefer blank lines without whitespace. Rather than continuing to override the default for different filetypes, it feels like it's time to change the default.
2019-06-08vimrc: Move RSpec mappings to ftplugin/ruby.vimTeddy Wing
Since I'm not writing Ruby regularly right now, move these mappings to the Ruby ftplugin so I don't accidentally try to run a spec in another language where it makes no sense.
2019-06-05ftplugin/gitcommit.vim: Turn on 'formatoptions' `n`Teddy Wing
This formats numbered lists so that they wrap to the beginning of the text, instead of being flush with the number. Before: 1. A list that goes beyond the text width and wraps to the number. After: 1. A list that goes beyond the text width and wraps to the text. Thanks to this blog post from Edward Yang for prompting me to read the |fo-table| help again more closely: http://blog.ezyang.com/2010/03/vim-textwidth/