<commit_before>"py_fuzzycomplete.vim - Omni Completion for python in vim
" Maintainer: <NAME> <<EMAIL>>
" Version: 0.1
"
" This part of the software is just the vim interface. The main source code
" lies in the python files around it.

if !has('python')
    echomsg "Error: Required vim compiled with +python"
    finish
endif


function! jedi#Complete(findstart, base)
    if a:findstart == 1
        return col('.')
    else
python << PYTHONEOF
if 1:
        row, column = vim.current.window.cursor
        source = '\n'.join(vim.current.buffer)
        try:
            completions = functions.complete(source, row, column)
            out = []
            for c in completions:
                d = dict(word=c.complete,
                         abbr=str(c),
                         menu=c.description,  # stuff directly behind the completion
                         info=c.help,  # docstr and similar stuff
                         kind=c.type,  # completion type
                         icase=1,  # case insensitive
                         dup=1,  # allow duplicates (maybe later remove this)
                )
                out.append(d)

            strout = str(out)
        except Exception as e:
            print 'error:', e
            strout = ''

        print 'end', strout
        vim.command('return ' + strout)
PYTHONEOF
    endif
endfunction


" ------------------------------------------------------------------------
" Initialization of Jedi
" ------------------------------------------------------------------------
"
let s:current_file=expand("<sfile>")

python << PYTHONEOF
""" here we initialize the jedi stuff """
import vim

# update the system path, to include the python scripts 
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(vim.eval('s:current_file'))))

import functions
PYTHONEOF

" vim: set et ts=4:
<commit_msg>module imports are working now<commit_after>"py_fuzzycomplete.vim - Omni Completion for python in vim
" Maintainer: <NAME> <<EMAIL>>
" Version: 0.1
"
" This part of the software is just the vim interface. The main source code
" lies in the python files around it.

if !has('python')
    echomsg "Error: Required vim compiled with +python"
    finish
endif

" ------------------------------------------------------------------------
" Completion
" ------------------------------------------------------------------------

function! jedi#Complete(findstart, base)
    if a:findstart == 1
        return col('.')
    else
python << PYTHONEOF
if 1:
        # TODO change the finstart column, to switch cases, if they are not right.
        row, column = vim.current.window.cursor
        buf_path = vim.current.buffer.name
        source = '\n'.join(vim.current.buffer)
        try:
            completions = functions.complete(source, row, column, buf_path)
            out = []
            for c in completions:
                d = dict(word=c.complete,
                         abbr=str(c),
                         menu=c.description,  # stuff directly behind the completion
                         info=c.help,  # docstr and similar stuff
                         kind=c.get_vim_type(),  # completion type
                         icase=1,  # case insensitive
                         dup=1,  # allow duplicates (maybe later remove this)
                )
                out.append(d)

            strout = str(out)
        except Exception as e:
            # print to stdout, will be in :messages
            print(traceback.format_exc())
            strout = ''

        #print 'end', strout
        vim.command('return ' + strout)
PYTHONEOF
    endif
endfunction


" ------------------------------------------------------------------------
" Initialization of Jedi
" ------------------------------------------------------------------------

let s:current_file=expand("<sfile>")

python << PYTHONEOF
""" here we initialize the jedi stuff """
import vim

# update the system path, to include the python scripts 
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(vim.eval('s:current_file'))))

import traceback  # for exception output

import functions
PYTHONEOF

" vim: set et ts=4:

{'fraction_non_alphanumeric': 0.18726145038167938, 'fraction_numerical': 0.003816793893129771, 'mean_word_length': 1.51378896882494, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3642236', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1075, 'n_words': 345}