diff --git a/README.md b/README.md index 00a2d48..0a14c80 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ $ vim +PluginInstall +qall * `let g:snips_email = "Your email"` * `let g:snips_github = "Your website"` -GVim are configured to use `Fantasque Sans Mono`: https://fontlibrary.org/en/font/fantasque-sans-mono +GVim is configured to use `Fantasque Sans Mono`: https://fontlibrary.org/en/font/fantasque-sans-mono If you want to use another one, edit `set guifont=Fantasque\ Sans\ Mono\ 14`. `F1` is mapped to run a script named `indentation`. It's a personal and ugly script that indents the html, css and javascript. If you want to use it, you must install `node` and run `sudo cp .vim/bin/* /usr/local/bin/`. diff --git a/vim/bin/indentation b/vim/bin/indentation index df0360f..608fea7 100755 --- a/vim/bin/indentation +++ b/vim/bin/indentation @@ -163,6 +163,8 @@ function indent($str) if ( (isset($html[$u + 1], $html[$u + 2], $html[$u + 3]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3]) == 'img') || + (isset($html[$u + 1], $html[$u + 2], $html[$u + 3]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3]) == 'col') + || (isset($html[$u + 1], $html[$u + 2], $html[$u + 3], $html[$u + 4], $html[$u + 5]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3].$html[$u + 4].$html[$u + 5]) == 'input') || (isset($html[$u + 1], $html[$u + 2], $html[$u + 3], $html[$u + 4]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3].$html[$u + 4]) == '?xml') @@ -171,6 +173,8 @@ function indent($str) || (isset($html[$u + 1], $html[$u + 2], $html[$u + 3], $html[$u + 4]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3].$html[$u + 4]) == 'meta') || + (isset($html[$u + 1], $html[$u + 2], $html[$u + 3], $html[$u + 4]) && strtolower($html[$u + 1].$html[$u + 2].$html[$u + 3].$html[$u + 4]) == 'path') + || (isset($html[$u + 1], $html[$u + 2]) && strtolower($html[$u + 1].$html[$u + 2]) == 'hr') || (isset($html[$u + 1], $html[$u + 2]) && strtolower($html[$u + 1].$html[$u + 2]) == 'br') @@ -234,8 +238,8 @@ if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] == '-')) { } else { if (file_exists($argv[1])) { if (preg_match('/.js(on)?$/', $argv[1])) { - $code = shell_exec(sprintf('%s %s', '/usr/local/bin/js-beautify', escapeshellarg($argv[1]))); - file_put_contents($argv[1], $code); + $cmd = sprintf('%s -f %s -o %s', '/usr/local/bin/js-beautify', escapeshellarg($argv[1]), escapeshellarg($argv[1])); + $code = shell_exec($cmd); } elseif (preg_match('/.css$/', $argv[1])) { $code = shell_exec(sprintf('%s %s | sed "s/\}/\}\n/g;s/ /\t/g"', 'lessc', escapeshellarg($argv[1]))); //$code = shell_exec(sprintf('%s %s | sed "s/\}/\}\n/g"', 'lessc', escapeshellarg($argv[1])));