mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-02-07 12:19:02 +00:00
![foo-dogsquared](/assets/img/avatar_default.png)
I've migrated to Neovim because of one thing... Luke Smith-senpai... Ever since I've seen him typed 'nvim' in his recent videos, I was devastated. All of those hours that my little heart and soul poured into creating a 130-line vimrc to configure Vim to its absolute in the way I wanted to use was gone. All of those 7 days and a few minutes every now and then, are crushed. It is truly a betrayal to see it use a modernized version of a relic of the past. I first thought, "How dare he?". I was not able to sleep well the following days. It was heart-wrenching. Out of spite, I've tried to. I've nothing left and you know there is a saying 'a weeb with nothing got nothing to lose'. All it took was to rename certain files, reinstall the plugin manager and its plugins, a grand total of 5 minutes. My heart skipped a beat. It was like being a birb with broken wings trying to fly and eventually didn't left off until its talon is in the ground. And the ground is Neovim. Now I love Neovim more than ever... Thank you Luke Smith Unaboomer-kun-senpai. It was truly a wonderful experience.
73 lines
1.8 KiB
Plaintext
73 lines
1.8 KiB
Plaintext
global !p
|
|
# Smartly automate inserting of certain characters.
|
|
# Mainly used for smart space insertion.
|
|
def smart_space(next_str, auto_str=" ", loose=False):
|
|
next_word = ""
|
|
|
|
if next_str:
|
|
if loose == True:
|
|
next_word = auto_str
|
|
elif next_str[0] in [",", ".", "-", "!", "?", " "]:
|
|
next_word = auto_str
|
|
|
|
return next_word
|
|
endglobal
|
|
|
|
snippet def "Define function with autocompleting docstrings" iw
|
|
def ${1:function_name}($2):
|
|
"""
|
|
${3:To be defined}
|
|
`!p
|
|
arguments = [ arg.strip() for arg in t[2].split(',') if arg != "self" or len(arg.strip()) > 0 ]
|
|
|
|
# Format the string with an indent.
|
|
snip >> 1
|
|
for arg in arguments:
|
|
split_arg = arg.split('=')
|
|
|
|
param = split_arg[0].strip()
|
|
if param:
|
|
snip += f":param: {param} - @TODO"
|
|
`
|
|
"""
|
|
endsnippet
|
|
|
|
# Quickly create a class definition.
|
|
# This is inspired from the demo GIF from the official GitHub page at https://github.com/sirver/UltiSnips.
|
|
snippet class "Class keyword with autocompleting docstrings" iw
|
|
class ${1:PICK_A_NAME_CLASS}`!p snip.rv = smart_space(t[2], '(', loose=True)`$2`!p snip.rv = smart_space(t[2], ')', loose=True)`:
|
|
""" ${3:Docstring for $1} """
|
|
|
|
def __init__(${4:self}):
|
|
"""
|
|
${5:Creates an instance of $1}
|
|
`!p
|
|
arguments = [ arg.strip() for arg in t[4].split(',') if arg != "self" or len(arg.strip()) > 0 ]
|
|
|
|
# Format the string with an indent.
|
|
snip >> 2
|
|
|
|
for arg in arguments:
|
|
split_arg = arg.split('=')
|
|
|
|
param = split_arg[0].strip()
|
|
|
|
if param:
|
|
snip += f":param: {param} - @TODO"
|
|
`
|
|
"""
|
|
|
|
`!p
|
|
# Shift by two indentation level
|
|
snip >> 2
|
|
snip += "" if not t[2] else f"{t[2]}.__init__(self)"
|
|
`
|
|
$6
|
|
endsnippet
|
|
|
|
snippet if_main "If __main__" biw
|
|
if __name__ == "__main__":
|
|
${1:print("Hello world!")}
|
|
endsnippet
|
|
|