]> gitweb.factorcode.org Git - factor.git/commitdiff
vim edit support { string = } vim
authorerg <erg@trifocus.net>
Thu, 3 Aug 2006 06:45:30 +0000 (06:45 +0000)
committererg <erg@trifocus.net>
Thu, 3 Aug 2006 06:45:30 +0000 (06:45 +0000)
library/tools/vim.factor [new file with mode: 0644]

diff --git a/library/tools/vim.factor b/library/tools/vim.factor
new file mode 100644 (file)
index 0000000..d3cc6f2
--- /dev/null
@@ -0,0 +1,14 @@
+IN: vim
+REQUIRES: process ;
+USING: io kernel parser prettyprint process sequences ;
+
+: file-modified stat fourth ;
+
+: vim-line/file ( file line -- )
+    >r "vim " swap append r> unparse " +" swap append3 system drop ;
+
+: vim ( spec -- )
+    #! Edit the file in vim.  Rerun the file if the timestamp is changed.
+    dup where first2 >r ?resource-path [ file-modified ] keep r>
+    [ vim-line/file ] 2keep drop file-modified = [ drop ] [ reload ] if ;
+