I like to replace the default enter/return key functionality with actually inserting a new line, and the same with space (but inserting a line above), e.g. here is my map:
nnoremap <CR> O<ESC>
nnoremap <space> o<ESC>
But the problem I have here is that it breaks selecting functionality. For example Omnisharp and Flake8 both bring up a new buffer which allows you to select errors, or browse found items. For example Flake8 lists any errors that it finds with the file, then you can select an item and press enter to navigate to that error. But if you do this with the enter/return key remapped then instead it will give the error:
E21: Cannot make changes, 'modifiable' is off
Unfortunately I can't find the default mapping for enter/return. Is there any other way to handle this? Or is there a way to change mapping based on what buffer you're currently in, as unmapping the enter/return key once mapped will restore this functionality. But any autocmd solutions with buffers I have came up with are poor and not very reliable.