diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-07 23:03:10 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-07 23:03:10 -0700 |
commit | e6a242ab7ec54b260ed02993eb8e22a7ee7aa0da (patch) | |
tree | 55ed28d590abb2853650159084fe9dc6b09de44f | |
parent | 185a87ab1152958ef0fc545c47bc92e3d3868bec (diff) | |
download | config.vim-e6a242ab7ec54b260ed02993eb8e22a7ee7aa0da.tar.gz config.vim-e6a242ab7ec54b260ed02993eb8e22a7ee7aa0da.tar.bz2 config.vim-e6a242ab7ec54b260ed02993eb8e22a7ee7aa0da.zip |
Remove google3 stuff from run-vim.py
-rwxr-xr-x | run_vim.py | 52 |
1 files changed, 18 insertions, 34 deletions
@@ -2,6 +2,7 @@ import neovim, os, re, sys, time + # Get a list of buffers that haven't been deleted. `nvim.buffers` includes # buffers that have had `:bdelete` called on them and aren't in the buffer # list, so we have to filter those out. @@ -10,15 +11,6 @@ def get_listed_buffers(nvim): if nvim.eval('buflisted(%d)' % buf.number)) -def resolve_google3(fname): - if fname.startswith('//depot/google3'): - cwd = os.getcwd() - if "/google3" in cwd: - depot_dir = cwd[:cwd.find('/google3')] - realfname = fname.replace('//depot', depot_dir) - return realfname - return fname - # Many terminals now support undercurl, but Neovim still looks for xterm-kitty # to enable it. if os.environ["TERM"] in ["alactritty", "xterm-256color"]: @@ -27,10 +19,7 @@ if os.environ["TERM"] in ["alactritty", "xterm-256color"]: # For now, treat all arguments that don't start with - or + as filenames. This # is good enough to recognize '-f' and `+11`, which is all this script really # needs right now. -filenames = [ - re.sub(' ', '\ ', os.path.abspath(resolve_google3(arg))) - for arg in sys.argv[1:] if not arg[0] in ['-', '+'] -] +filenames = [arg for arg in sys.argv[1:] if not arg[0] in ['-', '+']] try: nvim_socket = os.environ["NVIM"] @@ -44,22 +33,17 @@ existing_buffers = get_listed_buffers(nvim) if '--float' in sys.argv: - float_title = filenames[0] if len(filenames) > 0 else "" - nvim.command( - 'call nvim_open_win(0, 1, {' + - "'relative': 'editor'," + - "'width': 90," + - "'height': 40," + - "'col': (nvim_list_uis()[0].width / 2) - (90 / 2)," + - "'row': (nvim_list_uis()[0].height / 2) - (40 / 2)," + - "'anchor': 'NW'," + - "'style': 'minimal'," + - "'border': 'single'," + - "'title': [['" + float_title + "', 'Statement']]" + - "})"); - nvim.command("set winhighlight=Normal:Normal") + float_title = filenames[0] if len(filenames) > 0 else "" + nvim.command('call nvim_open_win(0, 1, {' + "'relative': 'editor'," + + "'width': 90," + "'height': 40," + + "'col': (nvim_list_uis()[0].width / 2) - (90 / 2)," + + "'row': (nvim_list_uis()[0].height / 2) - (40 / 2)," + + "'anchor': 'NW'," + "'style': 'minimal'," + + "'border': 'single'," + "'title': [['" + float_title + + "', 'Statement']]" + "})") + nvim.command("set winhighlight=Normal:Normal") else: - nvim.command('split') + nvim.command('split') nvim.command('args %s' % ' '.join(filenames)) @@ -82,14 +66,13 @@ if '-f' in sys.argv and len(new_buffers) > 0: # hides one of the buffers. channel_id = nvim.channel_id for buffer in new_buffers: - nvim.command(( - 'autocmd BufDelete,BufHidden,QuitPre <buffer=%d> ' + - 'call rpcnotify(%d, "check_buffers")' - ) % (buffer, channel_id)) + nvim.command( + ('autocmd BufDelete,BufHidden,QuitPre <buffer=%d> ' + + 'call rpcnotify(%d, "check_buffers")') % (buffer, channel_id)) stay_open = True while stay_open: - nvim.next_message() # block until `rpcnotify` is called + nvim.next_message() # block until `rpcnotify` is called open_buffers = [window.buffer.number for window in nvim.windows] stay_open = any([buffer in open_buffers for buffer in new_buffers]) @@ -102,5 +85,6 @@ if '-f' in sys.argv and len(new_buffers) > 0: # * Delete each of the buffers we created. nvim.command('argdel *') for buffer in new_buffers: - nvim.command('autocmd! BufDelete,BufHidden,QuitPre <buffer=%d>' % buffer) + nvim.command('autocmd! BufDelete,BufHidden,QuitPre <buffer=%d>' % + buffer) nvim.command('bdelete! %d' % buffer) |