<commit_before>" Vim filetype plugin
" Language:     F#
" Last Change:  Thu 23 Oct 2014 08:39:53 PM CEST
" Maintainer:   <NAME> <<EMAIL>>

if exists('b:did_ftplugin')
    finish
endif
let b:did_ftplugin = 1

let s:cpo_save = &cpo
set cpo&vim

" check for python support
if has('python')
    python <<EOF
import vim
import os
fsharp_dir = vim.eval("expand('<sfile>:p:h')")
sys.path.append(fsharp_dir)

from fsharpvim import FSAutoComplete,Statics
import pyvim

if Statics.fsac == None:
    debug = vim.eval("get(g:, 'fsharpbinding_debug', 0)") != '0'
    Statics.fsac = FSAutoComplete(fsharp_dir, debug)
fsautocomplete = Statics.fsac
b = vim.current.buffer
fsautocomplete.parse(b.name, True, b)
proj_file = None
#find project file if any - assumes fsproj file will be in the same directory as the fs or fsi file
file_name = vim.current.buffer.name
x,ext = os.path.splitext(file_name)
if '.fs' == ext or '.fsi' == ext:
    dir = os.path.dirname(os.path.realpath(file_name))
    projs = filter(lambda f: '.fsproj' == os.path.splitext(f)[1], os.listdir(dir))
    if len(projs):
        proj_file = os.path.join(dir, projs[0])
        fsautocomplete.project(proj_file)
EOF

    nnoremap <buffer> <leader>t :call fsharpbinding#python#TypeCheck()<cr>
    nnoremap <buffer> <leader>d :call fsharpbinding#python#GotoDecl()<cr>
    nnoremap <buffer> <leader>s :call fsharpbinding#python#GoBackFromDecl()<cr>

    com! -buffer LogFile call fsharpbinding#python#LoadLogFile()
    com! -buffer -nargs=* -complete=file ParseProject call fsharpbinding#python#ParseProject(<f-args>)
    com! -buffer -nargs=* -complete=file BuildProject call fsharpbinding#python#BuildProject(<f-args>)

    augroup fsharpbindings_au
        au!
        " closing the scratch window after leaving insert mode
        " is common practice
        au InsertLeave *.fs? if pumvisible() == 0|pclose|endif
    augroup END

    " omnicomplete
    setlocal omnifunc=fsharpbinding#python#Complete
endif

" enable syntax based folding
setl fdm=syntax

" comment settings
setl formatoptions=croql
setl commentstring=(*%s*)
setl comments=s0:*\ -,m0:*\ \ ,ex0:*),s1:(*,mb:*,ex:*),:\/\/\/,:\/\/

" make ftplugin undo-able
let b:undo_ftplugin = 'setl fo< cms< com< fdm<'

let &cpo = s:cpo_save

" vim: sw=4 et sts=4
<commit_msg>issue 782 fixed ordering of project and file parse when loading file<commit_after>" Vim filetype plugin
" Language:     F#
" Last Change:  Thu 23 Oct 2014 08:39:53 PM CEST
" Maintainer:   <NAME> <<EMAIL>>

if exists('b:did_ftplugin')
    finish
endif
let b:did_ftplugin = 1

let s:cpo_save = &cpo
set cpo&vim

" check for python support
if has('python')
    python <<EOF
import vim
import os
fsharp_dir = vim.eval("expand('<sfile>:p:h')")
sys.path.append(fsharp_dir)

from fsharpvim import FSAutoComplete,Statics
import pyvim

if Statics.fsac == None:
    debug = vim.eval("get(g:, 'fsharpbinding_debug', 0)") != '0'
    Statics.fsac = FSAutoComplete(fsharp_dir, debug)
fsautocomplete = Statics.fsac
proj_file = None
#find project file if any - assumes fsproj file will be in the same directory as the fs or fsi file
b = vim.current.buffer
x,ext = os.path.splitext(b.name)
if '.fs' == ext or '.fsi' == ext:
    dir = os.path.dirname(os.path.realpath(b.name))
    projs = filter(lambda f: '.fsproj' == os.path.splitext(f)[1], os.listdir(dir))
    if len(projs):
        proj_file = os.path.join(dir, projs[0])
        fsautocomplete.project(proj_file)
fsautocomplete.parse(b.name, True, b)
EOF

    nnoremap <buffer> <leader>t :call fsharpbinding#python#TypeCheck()<cr>
    nnoremap <buffer> <leader>d :call fsharpbinding#python#GotoDecl()<cr>
    nnoremap <buffer> <leader>s :call fsharpbinding#python#GoBackFromDecl()<cr>

    com! -buffer LogFile call fsharpbinding#python#LoadLogFile()
    com! -buffer -nargs=* -complete=file ParseProject call fsharpbinding#python#ParseProject(<f-args>)
    com! -buffer -nargs=* -complete=file BuildProject call fsharpbinding#python#BuildProject(<f-args>)

    augroup fsharpbindings_au
        au!
        " closing the scratch window after leaving insert mode
        " is common practice
        au InsertLeave *.fs? if pumvisible() == 0|pclose|endif
    augroup END

    " omnicomplete
    setlocal omnifunc=fsharpbinding#python#Complete
endif

" enable syntax based folding
setl fdm=syntax

" comment settings
setl formatoptions=croql
setl commentstring=(*%s*)
setl comments=s0:*\ -,m0:*\ \ ,ex0:*),s1:(*,mb:*,ex:*),:\/\/\/,:\/\/

" make ftplugin undo-able
let b:undo_ftplugin = 'setl fo< cms< com< fdm<'

let &cpo = s:cpo_save

" vim: sw=4 et sts=4

{'fraction_non_alphanumeric': 0.13420765027322404, 'fraction_numerical': 0.011147540983606558, 'mean_word_length': 4.211845102505695, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 33, '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': '1516596', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1629, 'n_words': 427}