:PlugInstall
to install plugins.make
ctags
get
No pkg-config found
error on executing ./autogen.sh
Sol.: install pkg-config package
建立程式碼的索引檔
on terminal:
$ctags -R --exclude=.svn
in vim:
!ctags -R --exclude=.svn
cscope
Generate database:
find -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.h' > cscope.files
cscope -Rbkq
去產生cscope.out, cscope.in.out, cscope.po.out這三個檔案.Commands and key mappings
:cstag /keyword
i_CTRL-X_CTRL-O
CTRL-X CTRL-O
.
Keyword completion (^N^P)
with ctags works correctlyMatchit
%
to jump between matching keywords as Vim already does for matching parentheses/brackets.Highlight Matchit
class endclass
沒有變色:HiMatch
可以正確執行,但手動輸入 :HiMatchOn
仍不會變色Supertab
Configures the <tab>
key to perform insert completion. To take full advantage of the omni completion
functionality.
Tagbar
:TagbarDebug
and got a warning from the output file located at .
, tagbardebug.log:
ref.: Tagbar doesn't populate, ctags.exe can't find file /tmp/vGCKBiZ/11.cs
–> It's a permission problem with /tmp
directory.
Sol.: change $TEP
or TMPDIR
environment variable to user local directory:
To replace Taglist
to Tagbar
on the command TriggerToggleALL
References:
FastFold
ref. accepted answer on "MacVim+NERDTree: How to open a file as a split in furthest horizontal split"
s
on the file name
i
on the file name
Run issues
There has two kinds of wrap
functions, Hard Wrap vs Soft Wrap:
Automatic word wrapping
NOT work on VIM version 8.2.3741
Added a visual indicator of where that 80 character border is to instead
Sol.: need a space
to be added between the last two words
I started from Using snipmate section and the command is:
Press and try :SnipMateOpenSnippetFiles for starting. Also see doc/SnipMate.txt to learn all SnipMate
The result:
at
line 1
on the buttom split, there has a_.snippet
file as default in the copied (sourced_non_forked) git repo, and the file could be opened by pressEnter
on theline 1
And, it constains some pre-defined snippets which are folded:
Use :zo
command to open a snippet, use 3 # (c) holds no legal value ;)
as example:
From the description in the introduction:
For example, in C, typing for<tab>
could be expanded to
with successive presses of tab jumping around the snippet.
c)<tab>
, and it was successfully expended to the copyright:Now we know that how to use the vim-snippet
, then, we are going to add own snippets:
An intuitive way is adding snippet to the default file mentioned before, but the repository is a copied version. We want to create a new snippets file maintained by ourself (e.g. upload it to Github).
SnipMateOpenSnippetFiles
, we can observe that it searches _.snippets
on several pathes
SnipMate doesn't work / My snippets aren't triggering
Check that your snippets file is located inside a foo/snippets
directory, where foo
is a path listed in your runtimepath
The runtimepath
in our vim setting (i.e. in .vimrc) is at ~/.vim_runtime
, as the line 5 in the following scratch:
The plugin will search "./snippets/_.snippets" under pathes in runtimepath
此外掛程式沒有提及如何編寫snippet,點擊此外掛程式於開頭介紹的其他類似的外掛程式,如UltiSnips, 於Screencast section的Episode 2: Creating Basic Snippets有列出幾個範例;我想編寫Linux kernel coding style
中的Comment的snippet, 需要plaintext的語法,故參考了最接近的範例,Complete Scripts in Shell Interpolation
。編寫如下:
接著,在VIM的insertion mode底下使用該snippet, 輸入內容如下:
c-long-comm<tab>
會遇到以下warning message:
從error message,
Key not present in Dictionary
, 看起來是沒有找到新增的snippet;亦有嘗試輸入預設的snippets, 沒有出現此error message。故回頭檢查c-long-comm
snippet的syntax, 與預設的snippets仔細比較後,發現snippet內容有用<tab>作為prefix;比較如下(分成上下兩個splits):
修正後的內容,請參考_.snippets
更多語法,請參考vim-snipmate於vim的manual,vim命令為:
help snippet-syntax
–> Press P
$vim -u NONE myfile
autocmd BufWritePre
於存檔時透過呼叫移除trailing white space
的function, 如下:
By jumplist
Jumps are remembered in a jump list. With the CTRL-O
and CTRL-I
command you can go to cursor positions before older jumps, and back again.
Nerdtree
References
press m
on the node you want to then select (m)ove the current node. Moving is the same as renaming.
Netrw
Ctrl-w h
or Ctrl-w ←
: Shift focus to split on left of current
Ctrl-w l
or Ctrl-w →
: Shift focus to split on right of current
Ctrl-w j
or Ctrl-w ↓
: Shift focus to split below the current
Ctrl-w k
or Ctrl-w ↑
: Shift focus to split above the current
NerdTree
windowT
m
+c
to copy a file (node)Open ack.vim for fast search:
map <leader>g :Ack
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal:
this message is 8 years ago, the bugs should be fixed. asahsieh