Skip to content

Instantly share code, notes, and snippets.

@tsukkee
tsukkee / volar-lsp-setting.vim
Last active September 1, 2021 15:39
Volarをvim-lspで動かしたい
let g:vim_lsp_settings_volar_options = #{
\ typescript: #{
\ serverPath: "/path/to/node_modules/typescript/lib/tsserverlibrary.js",
\ },
\ languageFeatures: #{
\ references: #{ enabledInTsScript: v:true },
\ definition: v:true,
\ typeDefinition: v:true,
\ callHierarchy: v:true,
\ hover: v:true,
@tsukkee
tsukkee / vcard2mitene.rb
Created December 14, 2019 16:57
macOSの連絡先.appから書き出したvCardをみてね年賀状用のCSVに加工する。 vcard2mitene.rb hoge.vcf | iconv -f utf8 -t cp932 > hoge.csv
require 'vcard'
require 'nkf'
file = open(ARGV[0], 'r')
vcard = Vcard::Vcard.decode(file)
def to_hiragane(katakana)
NKF.nkf('-w --hiragana', katakana)
end
@tsukkee
tsukkee / curses_test.c
Last active May 9, 2018 15:25
cursesでKEY_RESIZEがとれているかだけを見るプログラム
#include <stdlib.h>
#include <stdio.h>
#include <curses.h>
int main() {
WINDOW* mainwin;
if ((mainwin = initscr()) == NULL) {
fprintf(stderr, "Error initialsing ncurses.\n");
exit(EXIT_FAILURE);
@tsukkee
tsukkee / generator_test.vim
Created December 20, 2017 16:27
Generator?
function! Generator()
function! Inner1(value) closure
let i = a:value
function! Inner2(value) closure
let i += a:value
function! Inner3(value) closure
let i += a:value
function! Inner4(value) closure
let i += a:value
return {'value': i, 'done': v:true}
@tsukkee
tsukkee / VimConf2017_LT.md
Created November 4, 2017 14:44
VimConf 2017 LT: Visual Studio Code as a casual alternative of vim

Visual Studio Code as a casual alternative of vim

  • tsukkee

Vim is...

As you know, the world most powerful editor!!

But, note that, to use vim efficiently:

@tsukkee
tsukkee / pythread.vim
Last active December 11, 2015 04:39
古いVimだと動くけど、最新のVimだと動かない
echomsg 'begin'
python <<EOF
# coding: utf-8
import thread
import time
def func():
for i in range(0, 10):
print i
@tsukkee
tsukkee / python_vim_function.vim
Created December 17, 2011 14:23
Vim Advent Calendar 18日目
python <<EOM
# coding=utf-8
import vim
import re
# decorator for defining Vim script function
_functions_for_vim = {}
def vimfunc(name, *args):
def _(func):
_functions_for_vim[name] = func
@tsukkee
tsukkee / outputdebugstring.cpp
Created November 22, 2011 17:12
Macro for OutputDebugString (for Windows)
#include <windows.h>
#include <tchar.h>
#include <sstream>
typedef std::basic_stringstream<TCHAR> tstringstream;
template<typename T> tstringstream& operator,(tstringstream& tss, T t) { tss << _T(" ") << t; return tss; }
#define OUTPUT_DEBUG_STRING(...) ::OutputDebugString((tstringstream(), _T("***"), __VA_ARGS__, _T("\n")).str().c_str());
int main(int argc, char *argv[]) {
OUTPUT_DEBUG_STRING(_T("abc"), 1, 2.3, true); // -> " *** abc 1 2.3 1"
@tsukkee
tsukkee / yokohamavim2.vim
Created September 25, 2011 05:23
Yokohama.vim #2 presentation by tsukkee
--
Yokohama.vim #2
キーマッピングを考える
tsukkee
function! s:read_line() dict
let l:output = self.buffer
let l:res = l:output
while l:res !~ '\r\?\n' && !self.__eof
let l:res = self.read(256)
let l:output .= l:res
endwhile
let l:pos = match(l:output, '\v%(\r?\n|$)\zs')
let l:line = matchstr(l:output[: l:pos - 1], '.\{-}\ze\r\?\n$')