Skip to content

Instantly share code, notes, and snippets.

@techntools
techntools / vim-plugin-directories
Created March 12, 2025 18:29 — forked from nelstrom/vim-plugin-directories
An overview of what belongs in each directory of a Vim plugin.
plugin
naming convention: name_of_plugin.vim
these files are sourced for all file types
doc
naming convention: name_of_plugin.txt
these files document the functionality of a plugin
color
naming convention: name_of_colorscheme.vim
@techntools
techntools / path.md
Created March 12, 2025 11:05 — forked from romainl/path.md
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
@techntools
techntools / file_preview.vim
Created March 11, 2025 15:34 — forked from Konfekt/file_preview.vim
preview file under cursor in Vim using ctags as fallback
" Adapted from https://github.com/drmikehenry/vimfiles/blob/e5c369dadde340ead7438b0c4937c3f470acf524/vimrc#L3239
"
" With --extra=+f in ~/.ctags respectively --extras=+f in
" ~/.config/ctags/default.ctags, filenames are tags, too, so
" the following mappings will work when a file isn't in the path.
"
" For automatic (C)tags generation, see either
" https://tbaggery.com or https://bolt80.com/gutentags/
nnoremap <silent> gf :<c-u>call <sid>gf("gf")<cr>
@techntools
techntools / typescript.md
Created March 11, 2025 15:11 — forked from romainl/typescript.md
TypeScript ftplugin

TypeScript ftplugin

Attention! All this is a work in progress.

Include search

:help 'include' is set so that Vim recognizes both:

import Foo from 'foo';
@techntools
techntools / README.md
Created February 27, 2025 18:25 — forked from scttnlsn/README.md
Pub/sub with MongoDB and Node.js

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
@techntools
techntools / connect-remote-mongo-via-ssh-tunnel.md
Created February 13, 2021 18:38 — forked from umidjons/connect-remote-mongo-via-ssh-tunnel.md
Create ssh tunnel and connect to the remote mongo database on command line

Create ssh tunnel and connect to the remote mongo database on command line

Assume followings:

/mykeys/.ssh/prodserver.pem - is a certificate file

umid - is a user name

111.111.111.111 - is a remote host, that mongodb runs

@techntools
techntools / gist:e26dbabed42b2f734ed35d54128b99f5
Created February 13, 2021 18:37 — forked from levicook/gist:4132037
modeling friends and calculating mutual friends w/ mongodb
// ------------------------------------------------------------------
// Friend collection, where _id is a user.Id and Friends is a list, of user.Id.
// Note: friending and unfriending is a two step operation in this scheme:
> db.friends.find()
{ "_id" : 1, "friends" : [ 2, 3, 4 ] }
{ "_id" : 2, "friends" : [ 1, 3, 5 ] }
{ "_id" : 3, "friends" : [ 1, 2, 4, 5 ] }
{ "_id" : 4, "friends" : [ 1, 3, 5 ] }
{ "_id" : 5, "friends" : [ 2, 3, 4 ] }