cat
cd
+# Fetch Rule Syntax
+
+include [FILE]
+set [NAME] [VALUE]
+unset [NAME] [VALUE]
+is [NAME] [VALUE]
+isdir [VALUE]
+isfile [VALUE]
+findfile [VALUE]
+matches [NAME] [REGEX]
+exec [CMD] [ARGS...]
# Syntax Highlighting
/* Configuration Data
*****************************************************************************/
enum { /* Configuration Variables */
- FontString = 0, TagString, WinWidth, WinHeight, LineSpacing, LineNumbers,
- RulerColumn, EventTimeout, CopyIndent, TrimOnSave, ExpandTabs, TabWidth,
- ScrollLines, DblClickTime, MaxScanDist, SyntaxEnabled,
+ FontString = 0, EditTagString, CmdTagString, WinWidth, WinHeight,
+ LineSpacing, LineNumbers, RulerColumn, EventTimeout, CopyIndent, TrimOnSave,
+ ExpandTabs, TabWidth, ScrollLines, DblClickTime, MaxScanDist, SyntaxEnabled,
Color00, Color01, Color02, Color03, Color04, Color05, Color06, Color07,
Color08, Color09, Color10, Color11, Color12, Color13, Color14, Color15,
char* str;
} value;
} Options[] = {
- [TagString] = { "tide.ui.tags", STRING, {
+ [EditTagString] = { "tide.ui.tags.edit", STRING, {
.str = "Quit Save Undo Redo Cut Copy Paste | Find " } },
+ [CmdTagString] = { "tide.ui.tags.cmd", STRING, {
+ .str = "Quit Undo Redo Cut Copy Paste | Send Find " } },
#ifdef __MACH__
[FontString] = { "tide.ui.font", STRING, {
static void read_escape(char* data, long* i, long n) {
/* only one escape code supported and that is to change the working dir */
if (data[*i] != 'P') return;
+ for (long x = *i; x < n && data[x]; x++)
+ if (data[x] == '\a') data[x] = '\0';
size_t sz = strlen(&data[*i + 1]);
chdir(&data[*i + 1]);
*i = *i + 1 + sz;
export BASH_ENV="$EDITRCFILE"
export PROMPT_COMMAND='tide_cd "$PWD"'
-# Override
-function tide_cd(){ echo -en "\033P$PWD\0"; }
+# Provide a cd function to change tide's working directory manually. This could
+# be aliased or defined to cd but that interferes with some programs like rbenv.
+function tide_cd(){ echo -en "\033P$PWD\a"; }
export -f tide_cd
-function cd(){ cd "$@" && tide_cd "$@"; }
-export -f cd
edit(){
[[ -f "$EDITRCFILE" ]] && . "$EDITRCFILE"
def open_with(app)
app = Apps[app] || ENV[app.to_s.upcase]
+ puts "app: " + app
raise RuleError.new() if not app
spawn("#{app} #{$item}")
end
def find_file(file)
file = file.gsub(/^~/, ENV["HOME"])
if not file.match(/^\.?\//)
- file = `find . -path '*#{file}' -print -quit`.chomp
+ file = `find . -ipath '*/build/*' -prune -o -path '*#{file}' -print -quit`.chomp
end
raise RuleError.new() if (file.length == 0 || (not File.exist?(file)))
file
def mimetype(regex)
mtype = `file --mime-type #{$item} | cut -d' ' -f2`
- if not mtype.match(regex) then
- raise RuleError.new()
- end
+ raise RuleError.new() if not mtype.match(regex)
+ mtype
end
# Builtin Rules
char* shellcmd[] = { ShellCmd[0], NULL };
win_buf(EDIT)->crlf = 1;
config_set_int(TabWidth, 8);
- win_setlinenums(false);
- win_setruler(0);
pty_spawn(*cmd ? cmd : shellcmd);
}
if (!ShellCmd[0]) ShellCmd[0] = getenv("SHELL");
if (!ShellCmd[0]) ShellCmd[0] = "/bin/sh";
- /* Create the window and enter the event loop */
+ /* create the window */
win_window("tide", ondiagmsg);
- char* tags = getenv("EDITTAGS");
- win_settext(TAGS, (tags ? tags : config_get_str(TagString)));
- win_setruler(config_get_int(RulerColumn));
- win_setlinenums(config_get_bool(LineNumbers));
/* open all but the last file in new instances */
for (argc--, argv++; argc > 1; argc--, argv++) {
}
/* now create the window and start the event loop */
+ if (!pty_active()) {
+ win_settext(TAGS, config_get_str(EditTagString));
+ win_setruler(config_get_int(RulerColumn));
+ win_setlinenums(config_get_bool(LineNumbers));
+ } else {
+ win_settext(TAGS, config_get_str(CmdTagString));
+ win_setruler(0);
+ win_setlinenums(false);
+ }
win_setkeys(Bindings, oninput);
win_loop();
return 0;