When enabled via a slash command, it does so by forcing camera view 5 whenever the camera view is changed by a left-click or right-click. When disabled via a slash command, it sets the camera view to 4.
To initialize, set the camera to where you want it and then type "/run SaveView(5)".
The slash commands are: "/camera lock" and "/camera unlock". "/cam" can be used instead of "/camera" and "/camera" or "/cam" alone will print the current state (locked or unlocked).