Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
--- this shells out to https://llm.datasette.io/en/stable/
vim.api.nvim_create_user_command("LLM", function(opts)
local system = [[
You are a neovim expert.
You help users write commands.
When a user asks a question, your output will be copied directly into the neovim command prompt.
Do not add any explanation.
Since the output is being copied in the command line, it should all be on a single line.
]]
local output = vim.system(
@icholy
icholy / TSServer.py
Last active May 16, 2024 19:17
Python wrapper around TypeScript TSServer
#!/usr/bin/env python
#
# Copyright (C) 2015 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#!/usr/bin/expect -f
# Set timeout to prevent the script from hanging
set timeout -1
# Get the search pattern as a command line argument
if {[llength $argv] != 0} {
set pattern [lindex $argv 0]
} else {
puts "Error: search pattern not provided"
@icholy
icholy / lsptest.go
Last active September 11, 2023 00:35
package main
import (
"context"
"encoding/json"
"io"
"log"
"os"
"os/exec"
"path/filepath"
@icholy
icholy / httpx.go
Last active April 10, 2023 19:34
package httpx
import (
"net/http"
)
func WithStatus(code int, handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(code)
handler.ServeHTTP(w, r)
@icholy
icholy / tss_vim.md
Last active March 21, 2023 19:35
TypeScript autocomplete in vim

Install the tss tool.

git clone https://github.com/clausreinke/typescript-tools.git
cd typescript-tools
git checkout testing_ts1.4
npm install -g

Install vim plugin (my fork has a tiny tweak that made it work for me).

@icholy
icholy / _godoc
Last active February 17, 2022 19:17
godoc completions
#compdef godoc
typeset -A opt_args
local context state line
local pkgdir usrpkgdir
pkgdir="$GOROOT/src/pkg"
usrpkgdir="$GOPATH/src"
godoctmpl=~/.godoc_templates
@icholy
icholy / go_zsh_complete.md
Last active January 9, 2022 19:19
Zsh Tab Completion for Golang

Zsh Tab Completion for Golang

This is pretty specific to my setup but the idea can be adapted to work with pretty much anything.

Go has a flag package which makes parsing command line arguments really easy.

package main
@icholy
icholy / nvim_lsp_status_airline.lua
Last active January 3, 2022 18:52
TypeScript LSP status in Airline
-- The TypeScript LSP server takes a while before it's responsive. This is a janky way of indicating the server status in
-- airline. It works by adding "..." to the statusline when the LSP connects, and then removing the "..." when the first
-- set of diagnostics come in.
vim.cmd([[
let g:lsp_wait_added = 0
let g:lsp_wait_done = 0
function! LspWait(...)
let builder = a:1
let context = a:2