in progress...
If you are using vi/vim/gvim for scripting with cdo, you can sometimes hardly remember cdo commands or you are just too lazy to type out "sellonlatbox" all the time, this might be something for you.
For completion:
- Copy dictionary file ".vim/dictionary/cdo.dic" to "~/.vim/dictionary"
- Copy all desired variable dictionary files "*.dic" from this repositories ".vim/dictionary" to "~/.vim/dictionary"
- Copy the file ".vim/ftdetect/cdo.vim" to "~/.vim/ftdetect" to name the dictionaries that should be associated with a certain filetype. Default: cdo.dic associated with *.sh
- Add the following lines to your .vimrc file "~/.vimrc" to include dictionaries for completions
set complete+=k
set completeopt=longest,menuone
Optional completion:
- If you wish some dictionaries, eg. those for other model variables just comment those in in".vim/ftdetect/cdo.vim"
- If you want to use <Tab> for auto-completion like in your shell, add those lines to your .vimrc
" Use TAB to complete when typing words, else inserts TABs as usual.
" Uses dictionary and source files to find matching words to complete.
" "See help completion for source,
" Note: usual completion is on <C-n> but more trouble to press all the time.
" Never type the same word twice and maybe learn a new spellings!
" Use the Linux dictionary when spelling is in doubt.
" Window users can copy the file to their machine.
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
Source: http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion
The usual <Tab> command will still be executed when no completion is feasable, eg. in the beginning of (empty) lines
3. If you fancy other auto-completion setting, play with the line
set complete=longest,menuone
The current setting completes up to the last common string and then shows a menu. Other options are listed in the vim help or http://vimdoc.sourceforge.net/htmldoc/options.html#'completeopt'
For syntax highlighting:
- coming soon
Start typing your desired cdo command and hit <Control-N>
cdo sell<Ctrl-N>
Get the following autocompletion options
sellevel /..path..to..dic-file/cdo.dic
sellevidx /..path..to..dic-file/cdo.dic
sellonlatbox /..path..to..dic-file/cdo.dic
selltype /..path..to..dic-file/cdo.dic
Hit another <Ctrl-N> go get the first shown match
cdo sellevel
Hit another <Ctrl-N> to choose the next match or move down with arrow keys and hit for your choice
- helpme
- just starting
- list of dictionary items might be incomplete
Aaron Spring
Bundesstraße 53
ZMAW Room 229
aaron.spring@mpimet.mpg.de
Looking forward to receiving your questions, comments or wishes
- 0.1: basic auto-complete function based on cdoCompletion.bash as of 2016/09/06
- 0.2: some MPI-ESM variables included for HAMOCC: 2d, 3d and sediment; MPIOM: 2d, 3d and ECHAM6: BOT, LOG, ...; checkout this repositories ".vim/dictionary"
- cdo dictionary based on cdoCompletion.bash as of 2016/09/06: https://code.zmaw.de/projects/cdo/repository/revisions/master/entry/contrib/cdoCompletion.bash
- HAMOCC, MPIOM and ECHAM6 dictionaries based on variables from MPI-ESM LR Large Ensemble n=100 runs
// global attributes: :CDI = "Climate Data Interface version 1.6.4rc1 (http://code.zmaw.de/projects/cdi)" ; :Conventions = "CF-1.4" ; :MPIOM = "$Revision: mpiom/trunk 3749 $" ; ``` <br>
on stored on mistral:/work/mh1007/mpiesm1/experiments/
- proper syntax highlighting
- more description in completion popup, eg. syntax or variable longname
- anything else needed?
- Uwe Schulzweida, creator of cdo
- Prince K Xavier, the dude who setup auto-completion for NCL and made me think about this