Hello,
I found a quite easy way to get Cisco, Juniper and more or less any vendor syntax highlight while working via SSH on a node. Example below with show run
on a Cisco router:
http://image.noelshack.com/fichiers/2020/07/3/1581517429-screenshot-2020-02-12-at-15-21-52.png
This work by running a terminal inside Neovim. For Neovim, your terminal is a file, so neovim can apply file syntax highlighting. I know this sound tricky, but it works super well, and you can use it in your favorite terminal emulator for any language supported by neovim (I tested with Junos and IOS).
Installation:
- Install Neovim. This does not work with regular VIM with my tests.
- Install a plugin manager for Neovim, suck as Vim plug: https://github.com/junegunn/vim-plug.
- Create the file
~/.config/nvim/init.vim
with the following content: https://pastebin.com/BQcq9P2P
You're all set. Now you just need to SSH to a device doing the following steps.
- In a terminal, start neovim:
nvim
- Create a shell inside neovim with the command
:term
- You're are now in a terminal inside a neovim buffer. You can use
i
andEsc
to switch between terminal mode (where you can write like in a normal terminal) and normal mode (used to run Neovim command). From here, SSH to a router/switch/... - Use the command
:set ft=cisco
to activate syntax highlighting. Replace cisco by junos for Juniper nodes.
No comments:
Post a Comment