g | x | w | all
Bytes Lang Time Link
018Japt v2.0a0180822T133934ZShaggy
01705AB1E180822T113759ZKevin Cr
016Vyxal 2 j241031T231548Zarutonee
062Perl 6180823T230855ZJo King
150Java 11180823T122832ZKevin Cr
017Jelly180822T151451ZJonathan
020Jelly180822T113513Zuser2027
081JavaScript Node.js180822T130830ZShieru A
023Husk180822T115151Zბიმო
037Retina 0.8.2180822T123405ZNeil
095Python 2180822T113750ZTFeld

Japt v2.0a0, 20 19 18 bytes

r/^ +/mÈÎpÓMg2+XÊz

Try it

r/^ +/mÈÎpÓMg2+XÊz     :Implicit input of multi-line string
r                      :Replace
 /^ +/m                :  RegEx
       È               :  Pass matches through the following function as X
        Î              :    First character
         p             :    Repeat
          Ó            :      Bitwise NOT of the negation of
           Mg          :        Nth Fibonacci number, where n=
             2+        :          Add 2 to
               XÊ      :            Length of X
                 z     :            Floor divided by 2

05AB1E, 22 21 17 bytes

|εgyðÛ©g-;ÝÅfO®ú,

Try it online.

The alternative formula \$Fib(\frac{n}{2}+2)-1\$ instead of \$\sum_{i=1}^{i=\frac{n}{2}}{Fib(i)}\$ (credit to @JonathanAllan's Jelly answer for this formula) is now 1 byte longer due to a bug in 05AB1E (requiring a ï before the Åf), instead of equal length:

|εgyðÛ©g-;ÌïÅf<®ú,

Try it online.

Explanation:

|                 # Take a list of all newline separated input-lines
 ε                # Loop over each line:
                  #  (implicitly push the current line)
  g               #  Pop and push its length
   y              #  Push the current line again
    ðÛ            #  Trim all its leading spaces
      ©           #  Store the result in variable `®` (without popping)
       g          #  Pop and push its length as well
        -         #  Subtract both lengths from one another
         ;        #  Halve it, because they are multiples of 2 indented spaces
          Ý       #  Create a list in the range [0,n]
           Åf     #  Get the i'th Fibonacci number for each
             O    #  Sum them together
              ®   #  Push the current line with trimmed leading spaces
               ú  #  Pad it with the Fibonacci-sum amount of leading spaces
                , #  Pop and print this with trailing newline

Vyxal 2 j, 16 bytes

↵ƛ:øL:£ḟ½ÞFẎ∑I¥+
↵                  split on newlines
 ƛ                 for each line...
  :øL              remove leading spaces
     :£            push to the register 
       ḟ           first index of original w/ trimmed substring
        ½          halve
         ÞFẎ∑      sum of first n fibonacci numbers
             I     n spaces
              ¥+   add register

with flag j, which prints the stack joined with newlines

Try it Online!

Perl 6, 62 bytes

*.trans(/[\n|^]' '+/=>{"\n"~' 'x(1,1,*+*...*)[$/.ords/2+1]-1})

Try it online!

Java 11, 150 bytes

s->{for(var l:s.split("\n"))System.out.println(" ".repeat(f(l.length()-(l=l.stripLeading()).length())-1)+l);};int f(int n){return n<1?1:f(n-2)+f(n-4);}

Try it online (NOTE: Both String.repeat(int) and String.stripLeading() are emulated as repeat(String,int) and stripLeadingE(String) respectively, because Java 11 isn't on TIO yet.)

Explanation:

s->{                   // Method with String parameter and no return-type
  for(var l:s.split("\n"))
                       //  Loop over the lines of the input:
    System.out.println(//   Print with trailing new-line:
      " ".repeat(      //    Repeat a space this many times:
           f(          //     Call the separated (recursive) method `f` with the parameter:
             l.length()//      The length of the line,
             -(l=l.stripLeading()).length()
                       //      minus the length of the line without leading spaces
           )-1         //     minus 1
      )+l);};          //    And append the line without leading spaces

int f(int n){          // Separated method with integer as both parameter and return-type
  return n<1?          //  If the input is 0 or lower:
          1            //   Return 1
         :             //  Else:
          f(n-2)+f(n-4);}
                       //   Return a recursive call to `n-2` plus a recursive call to `n-4`

Jelly, 17 bytes

Ỵµwt©⁶$HÆḞ€⁶ẋ;®)Y

A full program which prints the result.

Try it online!

How?

The indentations required for a line of the output is \$Fib(\frac{s}{2}+2)-1\$ where \$s\$ is the number of spaces in the line of the input, and:

$$Fib(\frac{s}{2}+2)-1=\sum_{i=1}^{i=\frac{s}{2}}{Fib(i)}$$

(\$i\$ could also start at \$0\$ since \$Fib(0)=0\$)

Ỵµwt©⁶$HÆḞ€⁶ẋ;®)Y - Main Link: list of characters
Ỵ                 - split at newlines
 µ             )  - for each line:
      $           -   last 2 links as a monad:
     ⁶            -     literal space character
   t              -     trim from both sides
    ©             -     (copy to register)
  w               -   first index of that substring in the line
       H          -   halve (this is (s+1)/2)
        ÆḞ€       -   Fibonacci of €ach (using an implicit range [1,2,...,s/2]
                  -                      where the (s+1)/2 is floored to s/2)
           ⁶      -   literal space character
            ẋ     -   repeat (vectorises) (e.g. [1,1,2,3,5] -> [[' '],[' '],[' ',' '],[' ',' ',' '],[' ',' ',' ',' ',' ']]
              ®   -   recall from register
             ;    -   concatenate
                Y - join with newline characters 
                  - implicit print
                  -  ...smashes, so e.g. [[' '],[' '],[' ',' '],['x']] is just "    x"

Jelly, 20 bytes

Ỵµ=⁶i0‘H‘ÆḞ’⁶ẋ;t⁶$)Y

Try it online!


Explanation

Let \$x\$ be the 1-indexing index of the first non-whitespace character (\$1,3,5,7,\dots\$).

Then the new indent is

$$F_{(x+1)/2+1}-1$$

where \$F\$ is the Fibonacci function.

JavaScript (Node.js), 87 81 bytes

x=>x.replace(/^ */gm,s=>" ".repeat((g=(n,a=b=1)=>n?g(n-2,b,b+=a):b-1)(s.length)))

Try it online!

For small indent levels (up to 15), 61 bytes using approximation:

x=>x.replace(/^ */gm,s=>" ".repeat(1.272**s.length*1.171-.5))

Use 1.27202 ** s.length * 1.17082 - .5 for indents up to 21 levels

Husk, 23 bytes

mȯF+M(R' !∫Θİf→½L)↕=' ¶

Try it online!

Explanation

m(F+M(R' !∫Θİf→½L)↕=' )¶  -- full program
                       ¶  -- lines
m(                    )   -- map
                  ↕='     -- | split on first non-space
    M(           )        -- | with the spaces
                L         -- | | length
               ½          -- | | halve
              →           -- | | increment
            İf            -- | | Fibonacci numbers: [1,1,2,3,5..]
           Θ              -- | | prepend 0: [0,1,1,2,3,5..]
          ∫               -- | | cumulative sums: [0,1,2,4,7,12..]
         !                -- | | 1-based index
      R'                  -- | | replicate that many spaces
  F+                      -- | join

Retina 0.8.2, 37 bytes

m`^
 	 	
+`( +	)( +)	  
$2$1$1
 	 *	

Try it online! Warning: Lots of white space. Explanation:

m`^
 	 	

Prefix each line with space tab space tab. These keep track of the previous and current Fibonacci number.

+`( +   )( +)     
$2$1$1

For each two spaces of the original indentation, compute the next Fibonacci number by summing the previous two.

 	 *	

Subtract 1 from the result and delete the previous Fibonacci number.

Python 2, 111 109 100 95 bytes

g=lambda n:n<1or g(n-2)+g(n-4)
def f(I):
 for l in I:L=l.lstrip();print~-g(len(l)-len(L))*' '+L

Try it online!


Saved: