Skip to content

Instantly share code, notes, and snippets.

@ktnyt
Last active January 22, 2019 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktnyt/8eeb3f2d07347628695c7f6d291a9dab to your computer and use it in GitHub Desktop.
Save ktnyt/8eeb3f2d07347628695c7f6d291a9dab to your computer and use it in GitHub Desktop.
define-command -hidden -override c-family-insert-include-guards %{
evaluate-commands %sh{
case "${kak_opt_c_include_guard_style}" in
ifdef)
echo 'execute-keys ggi__<c-r>%__<ret><esc>gg/include/<ret>dggxs(/|\.)<ret>c_<esc><space>x~ggxyppI#ifndef<space><esc>jI#define<space><esc>jI#endif<space><space>//<space><esc>O<ret><ret><esc>'
;;
pragma)
echo 'execute-keys ggi#pragma<space>once<esc>'
;;
*);;
esac
}
}
define-command -params 1 -shell-script-candidates %{ find . -type f | grep -E '\.(h|hpp)$' | fzy -e "$1" } c-family-include %{
evaluate-commands %sh{
echo "execute-keys i#include<space>\"$1\"<ret><esc>"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment