Init repo
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__
|
||||
0
__init__.py
Normal file
0
__init__.py
Normal file
7
apps.txt
Normal file
7
apps.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
https://remedybg.itch.io/remedybg
|
||||
https://www.voidtools.com/downloads/
|
||||
https://www.baremetalsoft.com/baregrep/
|
||||
https://github.com/AlDanial/cloc
|
||||
https://github.com/BurntSushi/ripgrep
|
||||
https://www.ffmpeg.org/
|
||||
https://github.com/yt-dlp/yt-dlp
|
||||
3
config.json
Normal file
3
config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"sublime_text": "C:/dev/apps/Sublime Text/Data"
|
||||
}
|
||||
9
install.py
Normal file
9
install.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import update, shutil, json
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = json.loads(update.read_file("config.json"))
|
||||
away_subl_user = config["sublime_text"] + "/Packages/User"
|
||||
here_subl_user = "sublime_text"
|
||||
|
||||
for here in os.listdir(here_subl_user):
|
||||
shutil.copyfile(here_subl_user + "/" + here, away_subl_user + "/" + here)
|
||||
28
sublime_text/Default (Windows).sublime-keymap
Normal file
28
sublime_text/Default (Windows).sublime-keymap
Normal file
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{ "keys": ["ctrl+q"], "command": "goto_definition" },
|
||||
{ "keys": ["alt+q"], "command": "jump_back" },
|
||||
|
||||
{ "keys": ["ctrl+e"], "command": "next_result" },
|
||||
{ "keys": ["alt+e"], "command": "prev_result" },
|
||||
|
||||
{ "keys": ["ctrl+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
|
||||
{ "keys": ["ctrl+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} },
|
||||
{ "keys": ["ctrl+shift+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true} },
|
||||
{ "keys": ["ctrl+shift+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true} },
|
||||
|
||||
{ "keys": ["alt+up"], "command": "swap_line_up" },
|
||||
{ "keys": ["alt+down"], "command": "swap_line_down" },
|
||||
{ "keys": ["alt+left"], "command": "jump_back" },
|
||||
{ "keys": ["alt+right"], "command": "jump_forward" },
|
||||
|
||||
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
|
||||
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
|
||||
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
|
||||
{ "keys": ["ctrl+alt+up"], "command": "duplicate_line" },
|
||||
|
||||
|
||||
{ "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" },
|
||||
{ "keys": ["ctrl+r"], "command": "goto_symbol_in_project" },
|
||||
{ "keys": ["ctrl+m"], "command": "toggle_record_macro" },
|
||||
{ "keys": ["alt+m"], "command": "run_macro" },
|
||||
]
|
||||
35
sublime_text/Preferences.sublime-settings
Normal file
35
sublime_text/Preferences.sublime-settings
Normal file
@@ -0,0 +1,35 @@
|
||||
// Settings in here override those in "Default/Preferences.sublime-settings",
|
||||
// and are overridden in turn by syntax-specific settings.
|
||||
{
|
||||
"show_line_endings": true,
|
||||
"default_line_ending": "unix",
|
||||
"hardware_acceleration": "opengl",
|
||||
"auto_complete": false,
|
||||
|
||||
"highlight_line": true,
|
||||
"trim_trailing_white_space_on_save": "not_on_caret",
|
||||
"translate_tabs_to_spaces": true,
|
||||
"trim_only_modified_white_space": false,
|
||||
"auto_match_enabled": false,
|
||||
"hot_exit": "disabled",
|
||||
"hot_exit_projects": false,
|
||||
"ignored_packages":
|
||||
[
|
||||
"Vintage",
|
||||
],
|
||||
"index_files": true,
|
||||
// "color_scheme": "gruvbox (Light) (Soft).sublime-color-scheme",
|
||||
"font_size": 11,
|
||||
"font_face": "Cascadia Code",
|
||||
"theme": "Adaptive.sublime-theme",
|
||||
"folder_exclude_patterns": ["external", ".svn", ".git", ".hg", "CVS", ".Trash", ".Trash-*"],
|
||||
"vc_vars_cmd": [
|
||||
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||
],
|
||||
|
||||
// "line_numbers": false,
|
||||
// "gutter": false,
|
||||
// "margin": 0,
|
||||
"color_scheme": "gruvbox (Dark) (Hard).sublime-color-scheme",
|
||||
}
|
||||
6
sublime_text/call_build.sublime-build
Normal file
6
sublime_text/call_build.sublime-build
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"shell_cmd": "build.bat",
|
||||
"file_regex": "^(.*)\\((\\d+),?(\\d+)?\\)\\s?:\\s([^\n]+)", // msvc
|
||||
// "file_regex": "^(.*):(\\d+):(\\d+):", // clang
|
||||
"working_dir": "$folder",
|
||||
}
|
||||
9
sublime_text/comment_section.sublime-snippet
Normal file
9
sublime_text/comment_section.sublime-snippet
Normal file
@@ -0,0 +1,9 @@
|
||||
<snippet>
|
||||
<content><![CDATA[///////////////////////////////
|
||||
// ${1:section}
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<tabTrigger>////</tabTrigger>
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
||||
9
sublime_text/enum snippet.sublime-snippet
Normal file
9
sublime_text/enum snippet.sublime-snippet
Normal file
@@ -0,0 +1,9 @@
|
||||
<snippet>
|
||||
<content><![CDATA[typedef enum {
|
||||
} ${1:name};
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<tabTrigger>en</tabTrigger>
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<scope>(source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string</scope>
|
||||
</snippet>
|
||||
8
sublime_text/installed_packages.txt
Normal file
8
sublime_text/installed_packages.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
AlignTab :: Package Control
|
||||
ayu :: Package Control
|
||||
Clang Format :: Package Control
|
||||
gruvbox :: Package Control
|
||||
LiveServerPlus :: Package Control
|
||||
Odin :: Package Control
|
||||
Package Control :: Package Control
|
||||
Sublime_RemedyBG :: https://github.com/krzosa/Sublime_RemedyBG
|
||||
5
sublime_text/set_unix_line_ending.py
Normal file
5
sublime_text/set_unix_line_ending.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import sublime_plugin
|
||||
|
||||
class SetUnixLineEnding(sublime_plugin.EventListener):
|
||||
def on_pre_save(self, view):
|
||||
view.set_line_endings("unix")
|
||||
125
sublime_text/setup_vsvars.py
Normal file
125
sublime_text/setup_vsvars.py
Normal file
@@ -0,0 +1,125 @@
|
||||
import sublime
|
||||
import sublime_plugin
|
||||
import os
|
||||
|
||||
from threading import Thread
|
||||
from subprocess import Popen, PIPE
|
||||
from os import environ
|
||||
|
||||
# Related reading;
|
||||
# https://stackoverflow.com/questions/39881091/how-to-run-sublimetext-with-visual-studio-environment-enabled/
|
||||
|
||||
# For the unfamiliar, Visual Studio ships with a batch file which sets up the
|
||||
# environment variables you need to be able to run visual studio tools from a
|
||||
# command prompt.
|
||||
#
|
||||
# This pluguin was written in response to someone that wanted to know how you
|
||||
# could run Sublime and have it have the visual studio environment already set
|
||||
# up.
|
||||
#
|
||||
# This plugin will use a subprocess to execute the batch file in the background
|
||||
# and then issue the 'set' command to get the command interpreter to output the
|
||||
# state of the environment before it exits.
|
||||
#
|
||||
# This output is gathered and parsed to come up with a dictionary similar to
|
||||
# the environ table that python uses. From here we can easily detect what new
|
||||
# environment variables were added and the values of those that changed, and
|
||||
# set them as appropriate.
|
||||
#
|
||||
# As written Sublime needs to be restarted in order to execute the batch file
|
||||
# again. A more elegant solution would be to save the environment prior to
|
||||
# modifying it so that it could be restored and a new environment applied.
|
||||
|
||||
# To use this, you need to specify a setting in your user preferences named
|
||||
# 'vc_vars_cmd' which should contain a complete path to the batch file you want
|
||||
# to execute. Optionally you can also specify 'vc_vars_arch', which will be
|
||||
# passed as a command line argument to the batch file executed. Remember that
|
||||
# the preferences are JSON, so you need to quote all path separators.
|
||||
|
||||
SENTINEL="SUBL_VC_VARS"
|
||||
|
||||
def _get_vc_env():
|
||||
"""
|
||||
Run the batch file specified in the vc_vars_cmd setting (with an
|
||||
optional architecture type) and return back a dictionary of the
|
||||
environment that the batch file sets up.
|
||||
|
||||
Returns None if the preference is missing or the batch file fails.
|
||||
"""
|
||||
settings = sublime.load_settings("Preferences.sublime-settings")
|
||||
vars_cmd = settings.get("vc_vars_cmd")
|
||||
vars_arch = settings.get("vc_vars_arch", "amd64")
|
||||
|
||||
if vars_cmd is None:
|
||||
settings = sublime.load_settings("Remedy.sublime-settings")
|
||||
if settings:
|
||||
vars_cmd = settings.get("vc_vars_cmd")
|
||||
vars_arch = settings.get("vc_vars_arch", "amd64")
|
||||
|
||||
if type(vars_cmd) == list:
|
||||
for it in vars_cmd:
|
||||
if os.path.isfile(it):
|
||||
vars_cmd = it
|
||||
break
|
||||
|
||||
if vars_cmd is None:
|
||||
print("set_vc_vars: Cannot set Visual Studio Environment")
|
||||
print("set_vc_vars: Add 'vc_vars_cmd' setting to settings and restart")
|
||||
return None
|
||||
|
||||
try:
|
||||
# Run the batch, outputting a sentinel value so we can separate out
|
||||
# any error messages the batch might generate.
|
||||
shell_cmd = "\"{0}\" {1} && echo {2} && set".format(
|
||||
vars_cmd, vars_arch, SENTINEL)
|
||||
|
||||
output = Popen(shell_cmd, stdout=PIPE, shell=True).stdout.read()
|
||||
|
||||
lines = [line.strip() for line in output.decode("utf-8").splitlines()]
|
||||
env_lines = lines[lines.index(SENTINEL) + 1:]
|
||||
except:
|
||||
return None
|
||||
|
||||
# Convert from var=value to dictionary key/value pairs. We upper case the
|
||||
# keys, since Python does that to the mapping it stores in environ.
|
||||
env = {}
|
||||
for env_var in env_lines:
|
||||
parts = env_var.split("=", maxsplit=1)
|
||||
env[parts[0].upper()] = parts[1]
|
||||
|
||||
return env
|
||||
|
||||
def install_vc_env():
|
||||
"""
|
||||
Try to collect the appropriate Visual Studio environment variables and
|
||||
set them into the current environment.
|
||||
"""
|
||||
vc_env = _get_vc_env()
|
||||
if vc_env is None:
|
||||
print("set_vc_vars: Unable to fetch the Visual Studio Environment")
|
||||
return sublime.status_message("Error fetching VS Environment")
|
||||
|
||||
# Add newly set environment variables
|
||||
for key in vc_env.keys():
|
||||
if key not in environ:
|
||||
environ[key] = vc_env[key]
|
||||
|
||||
# Update existing variables whose values changed.
|
||||
for key in environ:
|
||||
if key in vc_env and environ[key] != vc_env[key]:
|
||||
environ[key] = vc_env[key]
|
||||
|
||||
# Set a sentinel variable so we know not to try setting up the path again.
|
||||
environ[SENTINEL] = "BOOTSTRAPPED"
|
||||
sublime.status_message("VS Environment enabled")
|
||||
|
||||
def plugin_loaded():
|
||||
if sublime.platform() != "windows":
|
||||
return sublime.status_message("VS is not supported on this platform")
|
||||
|
||||
# To reload the environment if it changes, restart Sublime.
|
||||
if SENTINEL in environ:
|
||||
return sublime.status_message("VS Environment already enabled")
|
||||
|
||||
# Update in the background so we don't block the UI
|
||||
Thread(target=install_vc_env).start()
|
||||
8
sublime_text/struct_snippet.sublime-snippet
Normal file
8
sublime_text/struct_snippet.sublime-snippet
Normal file
@@ -0,0 +1,8 @@
|
||||
<snippet>
|
||||
<content><![CDATA[typedef struct ${1:name} ${1:name};
|
||||
struct ${1:name} {
|
||||
};
|
||||
]]></content>
|
||||
<tabTrigger>st</tabTrigger>
|
||||
<scope>(source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string</scope>
|
||||
</snippet>
|
||||
38
update.py
Normal file
38
update.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os, json, shutil
|
||||
|
||||
def read_file(path):
|
||||
fd = open(path, "r")
|
||||
res = fd.read()
|
||||
fd.close()
|
||||
return res
|
||||
|
||||
def write_file(path, content):
|
||||
fd = open(path, "w")
|
||||
fd.write(content)
|
||||
fd.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = json.loads(read_file("config.json"))
|
||||
away_subl_user = config["sublime_text"] + "/Packages/User"
|
||||
here_subl_user = "sublime_text"
|
||||
|
||||
ok_patterns = [".sublime-build", "Preferences.sublime-settings", ".py", ".sublime-snippet", ".sublime-keymap"]
|
||||
if not os.path.isdir(here_subl_user):
|
||||
os.mkdir(here_subl_user)
|
||||
for it in os.listdir(away_subl_user):
|
||||
ok = False
|
||||
for it_patt in ok_patterns:
|
||||
if it.endswith(it_patt):
|
||||
ok = True
|
||||
if ok:
|
||||
away_file = away_subl_user + "/" + it
|
||||
here_file = here_subl_user + "/" + it
|
||||
shutil.copyfile(away_file, here_file)
|
||||
|
||||
installed_packages = ""
|
||||
for it in os.listdir(config["sublime_text"] + "/Installed Packages"):
|
||||
idx = it.find(".sublime-package")
|
||||
installed_packages += it[:idx] + " :: Package Control\n"
|
||||
installed_packages += "Sublime_RemedyBG :: https://github.com/krzosa/Sublime_RemedyBG\n"
|
||||
write_file(here_subl_user + "/installed_packages.txt", installed_packages)
|
||||
|
||||
Reference in New Issue
Block a user