@@ -151,10 +151,7 @@ impl Application {
151 compositor.push(Box::new(overlayed(picker)));
151 compositor.push(Box::new(overlayed(picker)));
153 let nr_of_files = args.files.len();
153 let nr_of_files = args.files.len();
154− editor.open(first, Action::VerticalSplit)?;
155− // Because the line above already opens the first file, we can
156− // simply skip opening it a second time by using .skip(1) here.
157− for (file, pos) in args.files.into_iter().skip(1) {
154+ for (i, (file, pos)) in args.files.into_iter().enumerate() {
158 if file.is_dir() {
155 if file.is_dir() {
159 return Err(anyhow::anyhow!(
156 return Err(anyhow::anyhow!(
160 "expected a path to file, found a directory. (to open a directory pass it as first argument)"
157 "expected a path to file, found a directory. (to open a directory pass it as first argument)"
@@ -166,6 +163,7 @@ impl Application {
166 // option. If neither of those two arguments are passed
163 // option. If neither of those two arguments are passed
167 // in, just load the files normally.
164 // in, just load the files normally.
168 let action = match args.split {
165 let action = match args.split {
166+ _ if i == 0 => Action::VerticalSplit,
169 Some(Layout::Vertical) => Action::VerticalSplit,
167 Some(Layout::Vertical) => Action::VerticalSplit,
170 Some(Layout::Horizontal) => Action::HorizontalSplit,
168 Some(Layout::Horizontal) => Action::HorizontalSplit,
171 None => Action::Load,
169 None => Action::Load,