Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use 'Tab' and 'C-Tab' to switch choosing parameters #36

Open
5 of 17 tasks
cjun714 opened this issue Jul 12, 2018 · 4 comments
Open
5 of 17 tasks

How can I use 'Tab' and 'C-Tab' to switch choosing parameters #36

cjun714 opened this issue Jul 12, 2018 · 4 comments

Comments

@cjun714
Copy link

cjun714 commented Jul 12, 2018

Issue Prelude

  • Category
    • Question
    • Bug
    • Suggestion
  • OS
    • Linux
    • macOS
    • Windows
    • Etc.
  • Vim
    • Vim
    • Neovim
  • Language
    • C
    • C++
    • go
    • python
    • rust
    • javascript
    • typescript
    • erlang

Dear tenfyzhong, thanks for your great amazing plugin.

Is it possible to use 'Tab' and 'C-Tab' to switch choosing parameters instead of 'C-j' and 'C-k', how should I config? setting as below is invalid:
imap (complete_parameter#goto_next_parameter)
imap (complete_parameter#goto_previous_parameter)
Sine in this scenario using 'Tab' is more sensible, just like other ide, editor or shell does, and another reason is I have mapped 'c-j' as as same as a shell.

Thanks!

@tenfyzhong
Copy link
Owner

I think you shoud map smap too.

@cjun714
Copy link
Author

cjun714 commented Jul 17, 2018

I have set smap, it's not working, setting:
smap (complete_parameter#goto_next_parameter)
imap (complete_parameter#goto_next_parameter)

Here is an example:

  1. input:
    os.Chmod("myname|", mode) // '|' is cursor position
  2. press Tab, expected result should be:
    os.Chmod("myname", |mode) // '|' is cursor position
  3. but result is :
    os.Chmod("myname    |", mode)

If map , result is right(as step 2)
If map , result is not expected(as step 3)

Plugins I am using (first to last in vim-plug):

  1. ultisnips
  2. deoplete
  3. CompleteParameter

@tenfyzhong
Copy link
Owner

Please give me a minimum configuration.

@cjun714
Copy link
Author

cjun714 commented Sep 9, 2018

Sorry for late response, please check below config, unnecessary part has been removed:

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-plug
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.local/share/nvim/plugged')

Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --go-completer' }
Plug 'SirVer/ultisnips'
Plug 'tenfyzhong/CompleteParameter.vim'

call plug#end()

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" global
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set noshowmode      " necessary for plugin echodoc.vim

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Key mapping
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
imap jj <Esc>
let mapleader=" "
" --------------------------------------------------------------------
map <leader>q :q!<CR>
nmap <C-q> :bp\|bd #<CR>

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Yggdroot/LeaderF
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <C-p> :call CtrlP('LeaderfFile')<CR>
nnoremap <C-b> :call CtrlP('LeaderfBuffer')<CR>
nnoremap <C-n> :call CtrlP('LeaderfMru')<CR>
nnoremap <C-r> :LeaderfBufTag<CR>
nnoremap <leader>j :LeaderfTag<CR>

" prevent opening file inside buffers like NERDTree
function! CtrlP(command)
    let c = 0
    let wincount = winnr('$')
    " Don't open it here if current buffer is not writable (e.g. NERDTree)
    while !empty(getbufvar(+expand("<abuf>"), "&buftype")) && c < wincount
        exec 'wincmd w'
        let c = c + 1
    endwhile
    exec a:command
endfunction

let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2" }
let g:Lf_WindowHeight = 0.30
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git']
let g:Lf_WorkingDirectoryMode = 'Ac'
let g:Lf_CacheDirectory = expand('/tmp/vim/cache')
let g:Lf_ShowRelativePath = 0
let g:Lf_HideHelp = 1
let g:Lf_StlColorscheme = 'powerline'
let g:Lf_PreviewResult = {'Function':0, 'BufTag':0}

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tenfyzhong/CompleteParameter.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
inoremap <silent><expr> ( complete_parameter#pre_complete("()")
smap <Tab> <Plug>(complete_parameter#goto_next_parameter)
imap <Tab> <Plug>(complete_parameter#goto_next_parameter)
" smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
" imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

let g:AutoPairs = {'[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
inoremap <buffer><silent> ) <C-R>=AutoPairsInsert(')')<CR>

let g:complete_parameter_use_ultisnips_mapping = 0

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SirVer/ultisnips
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"

let g:UltiSnipsSnippetDirectories=["UltiSnips", "UltiSnips+"]

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Valloric/YouCompleteMe
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'

let g:ycm_add_preview_to_completeopt = 0
let g:ycm_show_diagnostics_ui = 0
let g:ycm_server_log_level = 'info'
let g:ycm_min_num_identifier_candidate_chars = 2
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_complete_in_strings=1
let g:ycm_key_invoke_completion = '<c-z>'
set completeopt=menu,menuone

noremap <c-z> <NOP>

let g:ycm_semantic_triggers =  {
           \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
           \ 'cs,lua,javascript': ['re!\w{2}'],
           \ }

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

No branches or pull requests

2 participants