   (editor/off ed "vim-mode-change" (mode-change-listener ed))
   (object/raise ed :mode-change "normal-editor"))
 
+(defn close-ts-if-empty!
+  "Closes tab and tabset too if empty"
+  [obj]
+  (when-let [ts (:lt.objs.tabs/tabset @obj)]
+    (when (= (count (:objs @ts)) 1)
+      (tabs/rem-tabset ts)))
+  (object/raise obj :close))
+
 (behavior ::mode-change
           :triggers #{:mode-change}
           :reaction (fn [this mode]

          :exec (fn []
                  (let [cur (pool/last-active)]
                    (object/raise cur :save)
                    (object/raise cur :close)))})

(command {:command :vim-quit
          :desc "Vim: :q"
          :exec (fn []
                  (let [cur (pool/last-active)]
                    (object/raise cur :close)))})

(command {:command :vim-nohlsearch
          :desc "Vim: :nohlsearch"

            [lt.objs.command :as cmd :refer [command]]
            [lt.objs.editor :as editor]
            [lt.objs.console :as console]
            [lt.objs.notifos :as notifos]
            [lt.objs.tabs :as tabs])
  (:require-macros [lt.macros :refer [behavior]]))

(def mode-tags {:all #{:editor.keys.vim.insert :editor.keys.normal
