Skip to content

Instantly share code, notes, and snippets.

@musaprg
Created July 25, 2023 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musaprg/5def61a92a89ea2a80fb53445d30042e to your computer and use it in GitHub Desktop.
Save musaprg/5def61a92a89ea2a80fb53445d30042e to your computer and use it in GitHub Desktop.
Ctrl+nでexplorerをトグルするようにすることでVimのnerdtreeと使い勝手を統一するやつ
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpenNavigateNextInFilePicker",
"when": "inFilesPicker && inQuickOpen"
},
{
"key": "ctrl+b",
"command": "-workbench.action.toggleSidebarVisibility"
},
{
"key": "ctrl+n",
"command": "workbench.view.explorer"
},
{
"key": "ctrl+n",
"command": "workbench.action.toggleSidebarVisibility",
"when": "activeViewlet == 'workbench.view.explorer' || activeViewlet == 'workbench.view.search'|| activeViewlet == 'workbench.view.scm'|| activeViewlet == 'workbench.view.debug'|| activeViewlet == 'workbench.view.extensions' || activeViewlet == 'workbench.view.extension.test'|| activeViewlet == 'workbench.view.extension.bookmarks'|| activeViewlet == 'workbench.view.extension.project-manager' || activeViewlet == 'workbench.view.extension.gitlens'|| activeViewlet == 'workbench.view.extension.todo-tree-container'|| activeViewlet == 'snippet-explorer'"
}
]
@musaprg
Copy link
Author

musaprg commented Jul 25, 2023

自分のdotfilesのNerdtree設定

" show bookmark initially
let g:NERDTreeShowBookmarks=1
" Hide NERDtree if vim starts with specified filename
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" map :NERDTree to Ctrl+N
map <C-n> :NERDTreeToggle<CR>
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
 exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
 exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('py',     'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('md',     'blue',    'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml',    'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('config', 'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('conf',   'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('json',   'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('html',   'yellow',  'none', 'yellow',  '#151515')
call NERDTreeHighlightFile('styl',   'cyan',    'none', 'cyan',    '#151515')
call NERDTreeHighlightFile('css',    'cyan',    'none', 'cyan',    '#151515')
call NERDTreeHighlightFile('rb',     'Red',     'none', 'red',     '#151515')
call NERDTreeHighlightFile('js',     'Red',     'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php',    'Magenta', 'none', '#ff00ff', '#151515')

let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable  = '▶'
let g:NERDTreeDirArrowCollapsible = '▼'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment