kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
3.09k stars 61 forks source link

Is it possible it's a performance issue or is it my configuration? #115

Closed Invertisment closed 2 years ago

Invertisment commented 2 years ago

If I have this chunk of code and press ds{ then it lags quite a bit until it finds out what to do. The cursor position is almost at the bottom (marked with [CURSOR].

I already disabled the highlighting but I'm not sure if it helped. Maybe there is some other tweaking that I could do? Or maybe it's my formatter

(____ __-_____-________ [______]
  ;; ___ __________:
  ;; ___-__ _____ (_____ __ ______) -- :______/_______
  ;;
  ;; ___ ______ _______ _______ _____ ___ __________ (_________ __ ____).
  ;;
  ;; _____ ______ ___ _______ ____ (________ _______ _____ ____):
  ;; [{:_ :_} :______] => [:___ [:_____-____ {:_ :_} :______]]
  {:______/_____ [{} :______]
   :______/___________ [{} :______]
   :______/________-____ [{} :______]
   :______/________-______-__________ [{} [:___ {:___ 0} :______]]
   :______/_____-________-____-___ [{} :______]
   :______/_____-________-____-_____-_____ [{} :___]
   :______/_____-________-__________-____-_______-__-__-__ [{:________ ____} :___]
   :______/____-__ [{} :___]
   :______/_____-__-__ [{} :___]
   :______/___-__-__ [{} :___]
   :______/_________ [{} :_______]
   :______/___-___ [{} :_______]
   :______/____-__-_____ [{} :_______]
   :______/__________-_________ [{} :_______]
   :______/_______-________-________-____ [{} ____?]
   :______/____-________-________-____ [{} ____?]
   :______/_____-____ [{} ____?]
   :______/___-____ [{} ____?]
   :______/____-______ [{} :______]
   :______/____-_______-____-__-__ [{:________ ____} :___]
   :______/____-____-____-__-__ [{:________ ____} :___]
   :______/____-________ [{} :______]
   :______/_____ [{} :______]
   :______/__________ [{} :___]
   :______/_____-____ [{} :______]
   :______/____-____ [{} :______]
   :______/_____-_____ [{} :______]
   :______/_____-________ [{} :___]
   :______/_____-__________ [{} :_______]
   :______/_______-_____ [{} :______]
   :______/_______-______ [{} [:___ :______]]
   :______/_______-____________ [{} :______]
   :______/_____-______ [{} :_______]
   :______/_____-____-______ [{} :___]
   :______/______-_______ [{} :_______]
   :______/_________ [{} :______]
   :______/________ [{} :______]
   :______/____-_____ [{} :______]
   :______/____-_____ [{} :______]
   :______/____-___-___ [{} [:___ :______]]
   :______/____-__-__ [{} :___]
   :______/______ [{} :______]
   :______/____-___ [{} :______]
   :______/________-__-__ [{} :___]
   :______/______-__________ [{} [:___ :______]]
   :______/_______-____-_____ [{} :______]
   :______/__________-____ [{} :______]
   :______/_____________-_______-____ [{} :______]
   :______/_____________-_______-_____-__ [{:________ ____} :______]
   :______/_____________-_______-_____-_______-__ [{:________ ____} :______]
   :______/_____________-_______-_______-______-__ [{:________ ____} :______]
   :______/_____________-_______-_______-______-____-___ [{:________ ____} [:___ :______]]
   :______/_________-__-_______ [{} [:___ [:___ :_________-_______]]]
   :______/__________-__-__ [{:________ ____} :___]
   :______/_____________-__-__ [{:________ ____} :___]
   :______/______-____-________-_____-__-__ [{} :___]
   :______/______-____-________-___-__-__ [{} :___]
   :______/______-____-_____-_____-__-__ [{} :___]
   :______/______-____-_____-___-__-__ [{} :___]
   :______/______-____-_______-______-________-____ [{} :___]
   :______/______-____-______-____________ [{} [:___ [:___
                                                      [:_____ :______]
                                                      [:_____-_____-____ ____?]
                                                      [:_____-___-____ ____?]]]]
   :______/______-____-___-______-____ [{} [:___ [:___
                                                  [:____ ____?]
                                                  [:______ :______]]]]
   ;; ___'_ _______ ____ ___ `__________-_____`
   ;; __'_ _________ ___ ___ ________ ________.
   ;; ___ `________` _______ ____ ____ _____:
   ;; _____: _____________ ______ __________ ______ ____ ___________ __ _______ 3 _____ _____.
   ;; {"____" {"______-____" ____}}
   :______/__________-_____-_____ [{} (_____-__________-____/__-__________-______ ______)]
   :______/_________-_____-_____ [{} [:___ [:___
                                            [:____-___ :______]
                                            [:____-____ :______]
                                            [:_____-____ :______]
                                            [:_____-__-__ :___]
                                            [:_____-________-____ :___]]]]
   :______/_______-____ [{} :______]
   :______/__-__ [{} :___]
   :______/_____ [{} [:___ :______]]
   :______/________-_______-__ [{} ____?]
   :______/________-___-____-__-__ [{} :___]
   :______/________-____ [{} :______]
   :______/__________-____ [{:________ ____} :______]
   :______/_____________-______ [{:________ ____} :______]
   :______/____-_____ [{:________ ____} ______?]
   :______/____-____ [{:________ ____} :______]
   :______/_____-__________-___________-______ [{:________ ____} ______?]
   :______/_____-__________-_____-_______ [{:________ ____} ______?]
   :______/_____-__________-_____-_____ [{:________ ____} ______?]
   :______/_____-__________-_______-____ [{:________ ____} ______?]
   :______/_____-__________-__________-_______ [{:________ ____} ______?]
   :______/_____-__________-_______-_____ [{} ______?]
   :______/_____ [{:________ ____} [:___
                                    {:________ {:_____-____ [:_____
                                                             [:_____ ______? ______?]
                                                             [:_____ ______? ______?]
                                                             ______?]}}
                                    [:__ ______?]
                                    [:______ {:________ ____} :_____-____]
                                    [:________ {:________ ____} :_____-____]
                                    [:_____-1 {:________ ____} :_____-____]
                                    [:_____-2 {:________ ____} :_____-____]
                                    [:____ {:________ ____} :_____-____]]]
   :______/________ [{:________ ____} [:______ ______?]]
   :______/______ [{:________ ____} [:______ ______?]]
   :______/_____-_______ [{:________ ____} [:______ ______?]]
   :______/_________ [{:________ ____} [:______ [:___
                                                 [:_______-1 {:________ ____} ______?]
                                                 [:_______-2 {:________ ____} ______?]
                             [CURSOR]                    [:___ {:________ ____} ______?]
                                                 [:____________ {:________ ____} ______?]
                                                 [:_______ {:________ ____} ______?]]]]})
Invertisment commented 2 years ago

Probably it's my formatter.

kylechui commented 2 years ago

It is nearly instant for me; the plugin leverages text-objects to find the corresponding pair (at least on main), so the deletion should be nearly as fast as va} is.