Created
August 18, 2022 22:07
-
-
Save j2kun/e5f45f7c5ffe30062581c4bf59fa4fda to your computer and use it in GitHub Desktop.
Open BUILD file in vsplit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function open_build_in_vsplit() | |
| local current_filepath = vim.fn.expand('%:p:h') | |
| local current_filename = vim.fn.expand('%:t') | |
| vim.api.nvim_command('vsp ' .. current_filepath .. "/BUILD") | |
| vim.api.nvim_command('/' .. current_filename) | |
| end | |
| vim.keymap.set('n', '<leader>vb', ':lua open_build_in_vsplit()<CR>') |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also see
vim.opt.splitright = trueAnd the slightly more generalized command that drops you into ex mode so you can tabcomplete the filepath/name