fish-history-to-zsh
fish-history-to-zsh copied to clipboard
`Parser.js` error on Node.js v10.16.0 and `[email protected]`
(base) % node index.js > test /tmp/fish-history-to-zsh (master ⚡) sajeevs
/tmp/fish-history-to-zsh/node_modules/yamljs/lib/Parser.js:404
throw e;
^
Error: Unexpected characters near " \\}".
after running
(base) % nvm use /tmp/fish-history-to-zsh (master ⚡) sajeevs
Found '/tmp/fish-history-to-zsh/.nvmrc' with version <v10.16.0>
Now using node v10.16.0 (npm v6.9.0)
also
(base) % npm list /tmp/fish-history-to-zsh (master ⚡) sajeevs
[email protected] /tmp/fish-history-to-zsh
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected] deduped
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
I'm inclined to believe that fish_history is not actually proper YAML. Running it through a parser netted me this error:
Error: bad file 'fish_history': yaml: line 262: mapping values are not allowed in this context
Here's a quick command you can run in your terminal that will achieve the same thing:
grep -e "^- cmd: .*" $HOME/.local/share/fish/fish_history | awk '{print $3;}' >> ~/.zsh_history
@nick-at-dave awk print $3 will ensure that just the first word in each command makes it into your destination zhistory you'd need to do something like this to capture the entire command
grep -e "^- cmd: .*" $HOME/.local/share/fish/fish_history | awk '{for(i=3; i<=NF; i++) printf "%s%s", $i, (i<NF?OFS:"\n")}' >> ~/.zsh_history