ecosse3 / nvim

A non-minimal Neovim config built to work most efficiently with Frontend Development
GNU General Public License v3.0
1.22k stars 107 forks source link

Keybindings and shortcuts explained #63

Closed d0t15t closed 2 years ago

d0t15t commented 2 years ago

Hi, Thanks for this config! Once i updated to the latest neovim, the installer worked perfectly. Now I'm trying to understand your key-bindings. For instance, could you please explain exactly what you mean for:

<C - e>

What keys is that exactly?

Is there a shortcut for toggling between opened files? Or for searching for a file inside the File-Explorer? Is it possible to open files next to each other in a split-display? How do you comment out a single line?

Many thanks!

ecosse3 commented 2 years ago

Hi,

in Vim world when you want to create specific keymapping you need to use their naming notation for key shortcuts explained in command:

:h notation

In that case means control key combination with another key.

<S-…>       shift-key           *shift* *<S-*
<C-…>       control-key         *control* *ctrl* *<C-*
<M-…>       alt-key or meta-key     *META* *ALT* *<M-*
<A-…>       same as <M-…>           *<A-*
<D-…>       command-key or "super" key  *<D-*

For more details keymappings you can reference to keymappings.lua and which-key.lua which can be opened via Leader Key (Space).

Is there a shortcut for toggling between opened files?

It's just TAB and like in another IDEs.

Or for searching for a file inside the File-Explorer?

Just use vim search as usual via / key. For all files search in project use <C-P>

Is it possible to open files next to each other in a split-display?

Yes, in vim by default it's <C-w>v for vertical and <C-w>s for horizontal. In ecovim you can use <Leader>v for vertical split. If you want to open a new file in split from File Explorer or Telescope Files (via <C-P>) use <C-V> shortcut on file.

How do you comment out a single line?

Just use gcc in normal mode. It's described in readme here.

d0t15t commented 2 years ago

Thanks for the explanation! I'll try those...

crakton commented 2 years ago

Thanks for the keyboard bindings

I want to know how to format a file using prettier. Is there a way to do such using a key bind or shortcut key

ecosse3 commented 2 years ago

@Jrcity If you have Prettier configured with ESLint you can use <Leader>cf mapping to format.

crakton commented 2 years ago

Can you help me out with your prettier config and how to go about with setting it up. Please.

ecosse3 commented 2 years ago

Can you help me out with your prettier config and how to go about with setting it up. Please.

Unfortunately, it's not related to Ecovim, but in shortcut, you need to get eslint-config-prettier and eslint-plugin-prettier in your project and configure it in eslintrc file. Please refer to google.

d0t15t commented 2 years ago

Is it ok if I keep these questions going?

ecosse3 commented 2 years ago

Is it ok if I keep these questions going?

Yep, but all of them are in keymappings.lua and which-key.lua.

How do you achieve code-folding? To fold a long function, for instance...

Type :h E490. Thanks to treesitter you can fold functions etc. automatically by za.

Is there a snippet/shortcut for console.log(my_var)?

Yes, with LSP. It's log snippet. In future versions I will try to implement intelligent console.log with automatic variable completion based on treesitter.

moving a whole block of text up or down N lines?

https://github.com/ecosse3/nvim/blob/master/lua/keymappings.lua#L13-L15

d0t15t commented 2 years ago

:pray:

crakton commented 2 years ago

How do I read inline warnings and errors from a .tsx or .ts file I was using the keybind gl but it does not seem to work

ecosse3 commented 2 years ago

How do I read inline warnings and errors from a .tsx or .ts file I was using the keybind gl but it does not seem to work

@Jrcity <leader>cl is the keybinding for that. Feel free to remap for yourself.