
vim에 메이플레이더를 다음과 같이 설정했습니다.
let mapleader = ","
내가 시도할 때
:echo mapleader
,
올바르게 표시됩니다
그러나 다음은 작동하지 않습니다
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
리더를 제대로 설정하지 못해 vimwiki를 사용할 수 없습니다.
Google 검색을 많이 한 후에 좌절감을 느낍니다. 도와주세요.
vimwiki를 사용하기 위해 gvim도 설치했습니다. 설정된 모든 다중 위키는 gvim에서 액세스할 수 있지만 vim에서는 액세스할 수 없습니다.
다음은 내 vimrc 파일입니다.
" -----------------------------------------------------------------------------
" To make vimwiki properly
" -----------------------------------------------------------------------------
set nocompatible " put it on
filetype plugin on
syntax on
" -----------------------------------------------------------------------------
" end: To make vimwiki properly
" -----------------------------------------------------------------------------
set number " line numbers
set hlsearch " Highlight search results
set incsearch " set increment search
set ignorecase " case insensitive search, use \C anywhere with no space for case sensitive search
filetype off " required
" -----------------------------------------------------------------------------
" Basic mappings
" -----------------------------------------------------------------------------
let mapleader = ","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
" -----------------------------------------------------------------------------
" start : Plugins
" -----------------------------------------------------------------------------
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree' " Navigate and manipulate files in a tree view.
Plug 'gruvbox-community/gruvbox' " Gruvbox theme.
Plug 'junegunn/limelight.vim' " Dim paragraphs above and below the active paragraph.
Plug 'junegunn/goyo.vim' " Distraction free writing by removing UI elements and centering everything.
Plug 'vimwiki/vimwiki'
Plug 'godlygeek/tabular' "The tabular plugin must come before vim-markdown.
Plug 'plasticboy/vim-markdown' "The tabular plugin must come before vim-markdown.
call plug#end()
" -----------------------------------------------------------------------------
" End : Plugins
" -----------------------------------------------------------------------------
nmap <F6> :NERDTreeToggle<CR> " open or close nerd tree by pressing F6
nmap <Leader>w <Plug>VimwikiIndex
nmap <Leader>dy <Plug>VimwikiMakeYesterdayDiaryNote
" -----------------------------------------------------------------------------
" start : Status line
" -----------------------------------------------------------------------------
" Heavily inspired by: https://github.com/junegunn/dotfiles/blob/master/vimrc
function! s:statusline_expr()
let mod = "%{&modified ? '[+] ' : !&modifiable ? '[x] ' : ''}"
let ro = "%{&readonly ? '[RO] ' : ''}"
let ft = "%{len(&filetype) ? '['.&filetype.'] ' : ''}"
let fug = "%{exists('g:loaded_fugitive') ? fugitive#statusline() : ''}"
let sep = ' %= '
let pos = ' %-12(%l : %c%V%) '
let pct = ' %P'
return '[%n] %f %<'.mod.ro.ft.fug.sep.pos.'%*'.pct
endfunction
let &statusline = s:statusline_expr()
" -----------------------------------------------------------------------------
" end : Status line
" -----------------------------------------------------------------------------
" -----------------------------------------------------------------------------
" start : Color settings
" -----------------------------------------------------------------------------
colorscheme gruvbox
" For Gruvbox to look correct in terminal Vim you'll want to source a palette
" script that comes with the Gruvbox plugin.
"
" Add this to your ~/.profile file:
" source "$HOME/.vim/plugged/gruvbox/gruvbox_256palette.sh"
" Gruvbox comes with both a dark and light theme.
set background=dark
" Gruvbox has 'hard', 'medium' (default) and 'soft' contrast options.
let g:gruvbox_contrast_light='hard'
" This needs to come last, otherwise the colors aren't correct.
syntax on
" -----------------------------------------------------------------------------
" end : Color settings
" -----------------------------------------------------------------------------
" -----------------------------------------------------------------------------
" start : vimwiki
" -----------------------------------------------------------------------------
" vimwiki/vimwiki markdown syntax
" let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
" start: vimwiki multiple wikis
let wiki_1 = {}
let wiki_1.path = '~/vimwiki/'
let wiki_1.path_html = '~/vimwiki_html/'
let wiki_2 = {}
let wiki_2.path = '~/vimwiki/private/'
let wiki_2.path_html = '~/vimwiki/private_html/'
let wiki_3 = {}
let wiki_3.path = '~/vimwiki/technical/'
let wiki_3.path_html = '~/vimwiki/technical_html/'
let g:vimwiki_list = [wiki_1, wiki_2, wiki_3]
" end: vim multiple wikis
" -----------------------------------------------------------------------------
" end : vimwiki
" -----------------------------------------------------------------------------
답변1
.vimrc에 다음 줄을 추가하면 문제가 해결되었습니다.
let g:mapleader = ","
답변2
나는 출력을 얻었다는 것을 알았다.
<leader> works! It is set to ','
설정 후
:let mapleader = ","
:nnoremap <leader>a :echo("\<leader\> works! It is set to '<leader>'")<CR>
따옴표와 관련하여 미리 오류가 발생했습니다.
개인적으로 나는 다음을 사용하여 지도를 작성하는 것을 선호합니다.
map , <Leader>
테스트할 때 에 ,a
구현 된 변경 사항을 확인 vim
하십시오 .:source vimrc
vimrc