Browse Source

update bin and README

master
Simon Vieille 5 months ago
parent
commit
1a2edbce94
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
2 changed files with 7 additions and 3 deletions
  1. 1
    1
      README.md
  2. 6
    2
      vim/bin/indentation

+ 1
- 1
README.md View File

@@ -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/`.

+ 6
- 2
vim/bin/indentation View File

@@ -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])));

Loading…
Cancel
Save