# coc-explorer **Repository Path**: brightmind/coc-explorer ## Basic Information - **Project Name**: coc-explorer - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-11 - **Last Updated**: 2022-05-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # coc-explorer Explorer extension for [coc.nvim](https://github.com/neoclide/coc.nvim) **Note: This project is still under development and may be broken.** [![Build Status](https://img.shields.io/github/workflow/status/weirongxu/coc-explorer/coc-explorer%20CI)](https://github.com/weirongxu/coc-explorer/actions) ## Screenshot ![image](https://user-images.githubusercontent.com/1709861/76720263-471be100-6777-11ea-82c1-614627097b02.png) ## Requirements `>= vim 8.1.1418` or `>= neovim 0.3.1` ## Usage 1. Install by coc.nvim command: ``` :CocInstall coc-explorer ``` 2. Configuration custom vim mapping ``` :nmap e CocCommand explorer ``` 3. Open explorer ``` e ``` 4. Press `?` to show mappings help More at [Quickstart](https://github.com/weirongxu/coc-explorer/wiki/Quickstart) ## Feature - [x] Buffer source - [x] Highlight visible buffers in real time - [x] File tree source - [x] Basic actions - [x] Open file in select / vsplit / tab `explorer.openAction.strategy` options: - select: Open action use selection UI - vsplit: Open action use vsplit - split: Open action use split - tab: Open action use tab - previousBuffer: Open action use last used buffer - previousWindow: Open action use last used window - sourceWindow: Open action use the window where explorer opened - [x] Selection - [x] Cut / Copy / Paste - [x] Delete action use trash by default - [x] Other actions, press `?` in explorer to check out the all actions - [x] Git status - [x] Automatically reveal the current file - [x] Icons, use [nerdfont](https://github.com/ryanoasis/nerd-fonts) - [x] Search files by Coc-list - [x] Preview file attributes by floating window - [ ] LSP - [x] diagnostic - [ ] file rename (won't support, use [watchman](https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim#install-watchman-for-file-watching)) - [ ] Exrename, like [defx](https://github.com/Shougo/defx.nvim) - [ ] Archive file (use `lsar / unar`) - [ ] SSH - [x] ~~Bookmark source (DEPRECATED) (require [coc-bookmark](https://github.com/voldikss/coc-bookmark))~~ - [ ] Git source - [ ] Git actions - [x] Show help ## Command ``` :CocCommand explorer [options] [root-uri] ``` ### User events - `CocExplorerOpenPre`: triggered before open explorer - `CocExplorerOpenPost`: triggered after open explorer - `CocExplorerQuitPre`: triggered before quit explorer - `CocExplorerQuitPost`: triggered after quit explorer ### Example ```vim :CocCommand explorer \ --toggle \ --sources=buffer+,file+ \ /root/path ``` Reveal to current buffer for closest coc-explorer ```vim nmap er call CocAction('runCommand', 'explorer.doAction', 'closest', ['reveal:0'], [['relative', 0, 'file']]) ``` ### Presets ```vim let g:coc_explorer_global_presets = { \ '.vim': { \ 'root-uri': '~/.vim', \ }, \ 'cocConfig': { \ 'root-uri': '~/.config/coc', \ }, \ 'tab': { \ 'position': 'tab', \ 'quit-on-open': v:true, \ }, \ '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]' \ }, \ 'buffer': { \ 'sources': [{'name': 'buffer', 'expand': v:true}] \ }, \ } " Use preset argument to open it nmap ed CocCommand explorer --preset .vim nmap ef CocCommand explorer --preset floating nmap ec CocCommand explorer --preset cocConfig nmap eb CocCommand explorer --preset buffer " List all presets nmap el CocList explPresets ``` ### Options #### `[root-uri]` Explorer root, default is use `root-strategies` #### `--root-strategies ` Strategies for root uri, types `list of (keep | workspace | cwd | sourceBuffer | reveal | custom:name)` - `keep`: never change the root path - `workspace`: `workspace.root` - `cwd`: `getcwd()` - `sourceBuffer`: directory of buffer - `reveal`: directory of reveal path default is: `workspace,cwd,sourceBuffer,reveal` or `"explorer.root.strategies" of coc-settings` **Custom root patterns settings** ```jsonc { "explorer.root.customRules": { "vcs": { "patterns": [".git", ".hg", ".projections.json"] }, "vcs-r": { "patterns": [".git", ".hg", ".projections.json"], "bottomUp": true } } } ``` **Using custom root patterns** ```jsonc { "explorer.root.strategies": ["workspace", "custom:vcs", "custom:vcs-r"] } ``` or `:CocCommand explorer --root-strategies workspace,custom:vcs,custom:vcs-r` #### `--preset ` Open explorer use presets #### `--toggle | --no-toggle` Close the explorer if it exists, default: `--toggle` #### `--focus | --no-focus` Focus to explorer when opened, default: `--focus` #### `--open-action-strategy ` Strategy for open action, types: `select | vsplit | split | tab | previousBuffer | previousWindow | sourceWindow`, default: `select` #### `--quit-on-open | --no-quit-on-open` quit explorer when open action, default: `--no-quit-on-open` #### `--sources ` Explorer sources, example: `buffer+,file+`, default: `buffer-,file+` ``` expand collapsed │ ↓ ↓ buffer-,file+ └──┬─┘ └─┬┘ buffer source │ file source ``` #### `--position ` Explorer position, supported position: `left`, `right`, `tab`, `tab:0`, `tab:$`, `floating`, default: `left` #### `--width ` Width of Explorer window for open in left or right side, default: `40` #### `--content-width ` Content width, default: `0` #### `--content-width-type ` Type of content width, types: `win-width`, `vim-width`, , default: `vim-width` #### `--floating-position ` Explorer position for floating window, positions: - `left-center` - `center` - `right-center` - `center-top` - `,` default: `center` #### `--floating-width ` Width of Explorer window when position is floating, use negative value or zero to as `width - value`, default: `0` #### `--floating-height ` Height of Explorer window when position is floating, use negative value or zero to as `height - value`, default: `0` #### `--floating-content-width ` Width of content when position is floating, use negative value or zero to as `width - value`, default: `0` #### `--buffer-root-template