Save current vim session state and restore it later (e.g. buffers, splits etc.)
10
votes
1
answer
2736
views
As an old VIM user, attracted to it in the first place especially because of its straightforward regex substitutions that allow to work really fast, I'm not really expecting VIM to have such a feature. But, what the heck, maybe I overlooked something or some novelty.
Would you happen to know a way for
vim
, when reopening a huge list of files (all the cpp/h source files of a project namely) in n-column-split mode adapted to screen size (see bash command/alias below), to have previous open/selected/active buffers come back instead of resetting to the n first files across visible buffers? A bit like an IDE would do it, by saving the open files state.
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
alias vimcpp='find . \( -name '\''*.cpp'\'' -o -name '\''*.cc'\'' -o -name '\''*.cxx'\'' -o -name '\''*.c'\'' -o -name '\''*.hpp'\'' -o -name '\''*.hh'\'' -o -name '\''*.hxx'\'' -o -name '\''*.h'\'' \) -exec vim -O$(( ( ( $COLUMNS - 1 ) / 80 > 0 ) ? ( ( $COLUMNS - 1 ) / 80 ) : 1 )) \{} \+'
Asked by tomoyo255
(203 rep)
Apr 9, 2021, 07:45 AM
Last activity: Jul 31, 2022, 08:36 AM
Last activity: Jul 31, 2022, 08:36 AM