mirror of
				https://github.com/mhinz/vim-galore.git
				synced 2025-11-04 11:55:35 +08:00 
			
		
		
		
	Basics: Sessions?
This commit is contained in:
		@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
 | 
			
		||||
- Basics: [Marks?](README.md#marks)
 | 
			
		||||
- Basics: [Changelist?](README.md#changelist)
 | 
			
		||||
- Basics: [Changelist? Jumplist?](README.md#changelist-jumplist)
 | 
			
		||||
- Basics: [Sessions?](README.md#sessions)
 | 
			
		||||
- Tips: [Saner command-line history](README.md#saner-command-line-history)
 | 
			
		||||
- Usage: [Editing remote files](README.md#editing-remote-files)
 | 
			
		||||
- Usage: [Restore cursor position when opening file](#restore-cursor-position-when-opening-file)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								README.md
									
									
									
									
									
								
							@@ -21,6 +21,7 @@ added every day. Things about to be added can be found here:
 | 
			
		||||
- [Changelist? Jumplist?](#changelist-jumplist)
 | 
			
		||||
- [Quickfix and location lists?](#quickfix-and-location-lists)
 | 
			
		||||
- [Colorschemes?](#colorschemes)
 | 
			
		||||
- [Sessions?](#sessions)
 | 
			
		||||
- [Locality?](#locality)
 | 
			
		||||
 | 
			
		||||
#### [Usage](#usage-1)
 | 
			
		||||
@@ -516,6 +517,35 @@ I use [gruvbox](https://github.com/morhetz/gruvbox) for the GUI and
 | 
			
		||||
 | 
			
		||||
More colorschemes: [here](#list-of-colorschemes-1)
 | 
			
		||||
 | 
			
		||||
#### Sessions?
 | 
			
		||||
 | 
			
		||||
If you save a **view** (`:h :mkview`), the current state of the window (and
 | 
			
		||||
options and mappings) gets saved for later use (`:h :loadview`).
 | 
			
		||||
 | 
			
		||||
A **session** saves the views of all windows plus global settings. It basically
 | 
			
		||||
makes a snapshot of your current Vim instance and saves it in a session file.
 | 
			
		||||
 | 
			
		||||
This makes it perfect for saving your _projects_ and easy to switch between
 | 
			
		||||
them.
 | 
			
		||||
 | 
			
		||||
Try it right now! Open a few windows and tabs and do `:mksession! Foo.vim`. If
 | 
			
		||||
you omit the filename, `Session.vim` will be assumed. The file will be saved to
 | 
			
		||||
the current working directory, check `:pwd`. Restart Vim and do `:source
 | 
			
		||||
Foo.vim` and voilà, the buffer list, window layout, mappings, working directory
 | 
			
		||||
etc. should all be the same as before you saved the session.
 | 
			
		||||
 | 
			
		||||
Note that a session file is really just a collection of Vim commands, so feel
 | 
			
		||||
free to take a look at it: `:vs Foo.vim`.
 | 
			
		||||
 | 
			
		||||
You can tell Vim what things to save in a session by setting `'sessionoptions'`.
 | 
			
		||||
 | 
			
		||||
Related help:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
:h Session
 | 
			
		||||
:h 'sessionoptions'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Locality?
 | 
			
		||||
 | 
			
		||||
Many of the concepts mentioned above also have _local_ counterparts:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user