rudrab / vimf90

This is a fortran ide for vim. It is intended to make the coding with fortran easier and faster in vim.
https://rudrab.github.io/vimf90/
GNU General Public License v3.0
55 stars 4 forks source link

Key Binding Overwrites Important Default Mapping of Vim #15

Open Carltoffel opened 3 years ago

Carltoffel commented 3 years ago

The last commit has broken the default mapping of vim. For example I no longer can use the 'ce' command (create executable gets triggered). I guess something went wrong with the mapping of the leader key.

rudrab commented 3 years ago

I will check that. Thanks for reporting.

rudrab commented 3 years ago

Oh, I thought I have misunderstood you. You can define the keybindings in your vimrc. For Fortran90 menus, where ce is defined, you can overrite them as:

let fortran_compile="your value"
let fortran_exe=
let fortran_run=
let fortran_cla=
let fortran_dbg=
let fortran_make=
let fortran_makeProp=
let fortran_genProj=
rudrab commented 3 years ago

Please let me know if this solved your issue or revert back to me. Please close the issue and consider upvote the project if it solves your problem.

Carltoffel commented 3 years ago

This is not what i wanted to say. IMHO it is just not very smart for a plugin to overwrite a default vim command with something completely different. I would suggest to use the leader key of vim to initiate the commands of the plugin. Sure, I can rebind it, e.g. let fortran_compile="<Leader>ce", but I think this should be the default for the plugin, and if a user wants to overwrite the default vim mapping, it is still possible.

rudrab commented 3 years ago

I agree it is not very good (or should be avoided by all means) to override default mappings. The keybinding is actually defined in most generic way possible as: let b:fortran_compile = get(g:,"fortran_compile", get(g:,'mapleader', '\')."cc") so, if you define a mapleader, the problem is solved IMHO. Any suggestion is welcome though.

Carltoffel commented 3 years ago

I do have the mapleader defined (let mapleader="\<SPACE>"). Maybe this is the problem. If I set the mapleader to something else it works. Just a guess: Maybe your way of getting the mapleader is not aware of leader-keys longer than one character?

Carltoffel commented 3 years ago

Okay with let mapleader=" " I can fix my problem without changing the behaviour of vim. So maybe there is a problem with either the escape sequence or with the multi-character-leader.

Edit: I somehow was on the previous commit where it only worked with the " " leader. With the newest commit it only works if i set the mapleader to something like m but just a space does not work.

let mapleader="\<SPACE>" doesn't work let mapleader=" " doesn't work let mapleader="m" does work

Carltoffel commented 3 years ago

I don't know what your commands with let b:fortran_compile = get(... are doing exactly, but if I change them to be simply let b:fortran_compile = "<Leader>cc" etc. it works with all mapleaders mentioned above.