<commit_before># vim: set fdm=marker fdc=2 :
# coding=utf-8

# imports {{{1
import vim
import re
from os import walk
from os.path import join, getmtime, isfile
from subprocess import Popen, PIPE
from padlib.utils import get_save_dir
from padlib.pad import PadInfo
from padlib.timestamps import timestamp, natural_timestamp

# globals (caches) {{{1
cached_data = []
cached_timestamps = []
cached_filenames = []

def open_pad(path=None, first_line=None): #{{{1
    """Creates or opens a note.

    path: a valid path for a note.

    first_line: a string to insert to a new note, if given.
    """
    # we require self.save_dir_set to be set to a valid path
    if get_save_dir() == "":
        vim.command('let tmp = confirm("IMPORTANT:\n'\
                'Please set g:pad_dir to a valid path in your vimrc.", "OK", 1, "Error")')
        return

    # if no path is provided, we create one using the current time
    if not path:
        path = join(get_save_dir(), timestamp())

    if bool(int(vim.eval("g:pad_open_in_split"))):
        vim.command("silent! botright" + str(vim.eval("g:pad_window_height")) + "split " + path)
    else:
        vim.command("silent! edit " + path)

    # set the filetype to our default
    if vim.eval('&filetype') in ('', 'conf'):
        vim.command("set filetype=" + vim.eval("g:pad_default_format"))

    # map the local commands
    if bool(int(vim.eval('has("gui_running")'))):
        vim.command("noremap <silent> <buffer> <localleader><delete> :call pad#DeleteThis()<cr>")
    else:<commit_msg>don't keep notes in the buffer list when hidden.<commit_after># vim: set fdm=marker fdc=2 :
# coding=utf-8

# imports {{{1
import vim
import re
from os import walk
from os.path import join, getmtime, isfile
from subprocess import Popen, PIPE
from padlib.utils import get_save_dir
from padlib.pad import PadInfo
from padlib.timestamps import timestamp, natural_timestamp

# globals (caches) {{{1
cached_data = []
cached_timestamps = []
cached_filenames = []

def open_pad(path=None, first_line=None): #{{{1
    """Creates or opens a note.

    path: a valid path for a note.

    first_line: a string to insert to a new note, if given.
    """
    # we require self.save_dir_set to be set to a valid path
    if get_save_dir() == "":
        vim.command('let tmp = confirm("IMPORTANT:\n'\
                'Please set g:pad_dir to a valid path in your vimrc.", "OK", 1, "Error")')
        return

    # if no path is provided, we create one using the current time
    if not path:
        path = join(get_save_dir(), timestamp())

    if bool(int(vim.eval("g:pad_open_in_split"))):
        vim.command("silent! botright" + str(vim.eval("g:pad_window_height")) + "split " + path)
    else:
        vim.command("silent! edit " + path)

    # we don't keep the buffer when we hide it
    vim.command("set bufhidden=wipe")

    # set the filetype to our default
    if vim.eval('&filetype') in ('', 'conf'):
        vim.command("set filetype=" + vim.eval("g:pad_default_format"))

    # map the local commands
    if bool(int(vim.eval('has("gui_running")'))):
        vim.command("noremap <silent> <buffer> <localleader><delete> :call pad#DeleteThis()<cr>")
    else:
{'fraction_non_alphanumeric': 0.13120899718837864, 'fraction_numerical': 0.0037488284910965324, 'mean_word_length': 3.4226519337016574, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, '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': '481941', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1051, 'n_words': 332}