@import url("resource:///org/gnome/builder/keybindings/shared.css");

@binding-set default-ide-source-view
{
  bind "Escape" { "clear-search" ()
                  "clear-modifier" ()
                  "clear-selection" ()
                  "clear-count" ()
                  "clear-snippets" ()
                  "hide-completion" () };
  bind "<ctrl>f" { "action" ("frame", "find", "3") };
  bind "<ctrl>o" { "action" ("win", "open-with-dialog", "") };
  bind "<ctrl>s" { "action" ("view", "save", "") };
  bind "<ctrl><shift>s" { "action" ("view", "save-as", "") };
  bind "<alt><shift>Left" { "action" ("view-stack", "go-backward", "") };
  bind "<alt><shift>Right" { "action" ("view-stack", "go-forward", "") };
  bind "<ctrl>w" { "action" ("view", "close", "") };
  bind "<alt>period" { "goto-definition" () };
  bind "<ctrl>k" { "action" ("view-stack", "show-list", "") };
  bind "<ctrl>d" { "delete-from-cursor" (paragraphs, 1) };
  bind "<ctrl>j" { "join-lines" () };
  bind "<ctrl>u" { "change-case" (upper) };
  bind "<ctrl>l" { "change-case" (lower) };
  bind "<ctrl>i" { "action" ("editor-controls", "goto-line", "") };
  bind "<ctrl>asciitilde" { "change-case" (toggle) };
  bind "<ctrl><alt>d" { "duplicate-entire-line" ()};

  bind "<ctrl>minus" { "decrease-font-size" () };
  bind "<ctrl>plus" { "increase-font-size" () };
  bind "<ctrl>equal" { "increase-font-size" () };
  bind "<ctrl>0" { "reset-font-size" () };

  /* cycle "tabs" */
  bind "<ctrl><alt>Page_Up" { "action" ("view-stack", "previous-view", "") };
  bind "<ctrl><alt>KP_Page_Up" { "action" ("view-stack", "previous-view", "") };
  bind "<ctrl><alt>Page_Down" { "action" ("view-stack", "next-view", "") };
  bind "<ctrl><alt>KP_Page_Down" { "action" ("view-stack", "next-view", "") };

  bind "F2" { "clear-selection" ()
              "movement" (previous-word-end, 0, 1, 1)
              "movement" (next-word-start, 0, 1, 0)
              "movement" (next-word-end, 1, 0, 1)
              "request-documentation" ()
              "clear-count" ()
              "clear-selection" () };
  bind "F4" { "action" ("view", "find-other-file", "") };

  bind "<alt>n" { "move-error" (down) };
  bind "<alt>p" { "move-error" (up) };

  bind "<ctrl>g" { "move-search" (down, 0, 1, 1, 1, -1) };
  bind "<ctrl><shift>g" { "move-search" (up, 0, 1, 0, 1, -1) };
  bind "<ctrl><shift>k" { "clear-search" () };

  bind "<ctrl><alt>i" { "reindent" () };
}

idesourceviewmode.default {
  -gtk-key-bindings: default-ide-source-view;
}

treeview.project-tree {
  -gtk-key-bindings: builder-gb-project-tree;
}
