weirongxu / coc-explorer

📁 Explorer for coc.nvim
MIT License
1.14k stars 45 forks source link

How do I make the explorer to stay on the left side? #488

Closed scottming closed 2 years ago

scottming commented 2 years ago

When I configure the following shortcuts

nnoremap <C-h> <C-w>h         
nnoremap <C-j> <C-w>j         
nnoremap <C-k> <C-w>k         
nnoremap <C-l> <C-w>L

let g:coc_explorer_global_presets = {
\   '.vim': {
\     'root-uri': '~/.vim',
\   },
\   'tab': {
\     'position': 'tab',
\     'quit-on-open': v:true,
\   },
\   'floating': {
\     'position': 'floating',
\     'open-action-strategy': 'sourceWindow',
\   },
\   'floatingTop': {
\     'position': 'floating',
\     'floating-position': 'center-top',
\     'open-action-strategy': 'sourceWindow',
\   },
\   'floatingLeftside': {
\     'position': 'floating',
\     'floating-position': 'left-center',
\     'floating-width': 50,
\     'open-action-strategy': 'sourceWindow',
\   },
\   'floatingRightside': {
\     'position': 'floating',
\     'floating-position': 'right-center',
\     'floating-width': 50,
\     'open-action-strategy': 'sourceWindow',
\   },
\   'simplify': {
\     'file-child-template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]'
\   }
\ }

This is my coc config:

{
  "explorer.width": 30,
  "explorer.icon.enableNerdfont": true,
  "explorer.previewAction.onHover": false,
  "explorer.keyMappings.global": {
    "<cr>": ["expandable?", "expand", "open"],
    "v": "open:vsplit"
  }}

my explorer goes off as soon as I do a few more left/right moves(ctrl-l and ctrl-h).

image

weirongxu commented 2 years ago

I can't reproduce the issue, <c-w>l shouldn't change the position of the window, maybe your other plugins are causing the issue, use the minim config, or remove the plugins to confirm which plugin is causing the issue.

scottming commented 2 years ago

image

.config/nvim/init.vim

call plug#begin('~/.vim/plugged')

Plug 'neoclide/coc.nvim', {'branch': 'release'}

" Initialize plugin system
call plug#end()

nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>L

I can reproduce this problem with this small config on macOS when use <C-l>.

weirongxu commented 2 years ago

<C-w>L will always move any vim window, you should use <c-w>l