Supported syntax:
- and (
a b,a AND b) - or (
a OR b) - not (
NOT a) - grouping (
(a))
javascript:(()=>{let s=x=>x.replace(/([^\\]|^)\n/,'$1 \n').replace('<','<').replace('>','>'),f=e=>(({'#text':e=>s(e.textContent),DIV:g('\n\n'),P:g(''),OL:e=>[...e.childNodes].map((x,i)=>`${i+(e.start??1)}. ${f(x).replace(/\n/,'\n '+' '.repeat(`${i}`.length))}`).join('\n'),UL:e=>[...e.childNodes].map(x=>`- ${f(x).replace(/\n/,'\n ')}`).join('\n'),LI:g(''),TABLE:e=>`|${[...e.querySelectorAll('thead th')].map(f).join('|')}|\n|${[...e.querySelectorAll('thead th')].map(x=>'---').join('|')}|\n`+[...e.querySelectorAll('tbody tr')].map(x=>`|${[...x.children].map(g('')).join('|')}|`).join('\n'),PRE:e=>'```'+e.querySelector('.hljs').className.replace(/^.*language-(\S+).*$/,'$1')+'\n'+e.querySelector('.hljs').innerText.replace(/([^\n])$/,'$1\n')+'```',CODE:e=>'`'+e.innerText+'`',STRONG:e=>`**${g('')(e)}**`,EM:e=>`_${g('')(e)}_`,DEL:e=>`<del>${g('')(e)}</del>`,IMG:e=>``})[e.nodeName]??(e=>s(e.innerText)))(e),g=j=>e=>[...e.childNodes].map(f).join
This is just a experimental code. Not for practical use.
More useful version is on macrat/askgpt.vim.
Place autoload-chatgpt.vim to ~/.vim/autoload/chatgpt.vim.
Write this to your vimrc:
| function flattenvim() { | |
| if [ "${VIM_SERVERNAME}" != "" ]; then | |
| \vim --servername ${VIM_SERVERNAME} --remote $* | |
| else | |
| \vim --servername "$(head -c 12 /dev/random | base64)" $* | |
| fi | |
| } | |
| alias vi=flattenvim | |
| alias vim=flattenvim |
| param( | |
| [parameter(Mandatory, Position=0, ParameterSetName="Normal")] | |
| [Int]$Number, | |
| [parameter(ParameterSetName="Normal")] | |
| [String]$OutputPath = "out.txt", | |
| [parameter(ParameterSetName="Test")] | |
| [switch]$Test = $false | |
| ) |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>ANSIBlackColor</key> | |
| <data> | |
| YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS | |
| AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGmCwwXGxwjVSRudWxs1Q0ODxAR | |
| EhMUFRZcTlNDb21wb25lbnRzVU5TUkdCXE5TQ29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29s | |
| b3JTcGFjZVYkY2xhc3NPECgwLjAyNzQ1MTAwNjcgMC4yMTE3NjQ3MjMxIDAuMjU4ODIz |
| const path = require('path'); | |
| const {promises: fs} = require('fs'); | |
| const Jimp = require('jimp'); | |
| const imageminMozjpeg = require('imagemin-mozjpeg'); | |
| const imageminWebp = require('imagemin-webp'); | |
| const imageminZopfli = require('imagemin-zopfli'); | |
| const Sharp = require('sharp'); | |
| package test | |
| import ( | |
| "testing" | |
| "context" | |
| "github.com/go-redis/redis" | |
| etcd "go.etcd.io/etcd/client" | |
| ) |
| """ FizzBuzzのフレームワーク | |
| 本気でFizzBuzzを作ったら、パイプライン処理のライブラリが出来た。 | |
| """ | |
| from typing import Any, List | |
| class EndOfList(Exception): | |
| """ 処理を終了したいときに送出するエラー """ |