[vim] Ensure backup, swap, and undo directories exist so those state files are placed correctly
This commit is contained in:
		
							parent
							
								
									31492fe257
								
							
						
					
					
						commit
						3a3b73a915
					
				
					 2 changed files with 24 additions and 22 deletions
				
			
		|  | @ -5,6 +5,7 @@ vim.cmd [[ source ~/.vimrc.common ]] | |||
| 
 | ||||
| require 'configuration' | ||||
| require 'keys' | ||||
| require 'os' | ||||
| 
 | ||||
| vim.cmd [[ source ~/.vim/plugins.vim ]] | ||||
| 
 | ||||
|  | @ -16,9 +17,9 @@ function ensure_metadata_directories_exist() | |||
|     } | ||||
| 
 | ||||
|     for _, opt in ipairs(paths) do | ||||
|         local first_path = opt[1] | ||||
|         if string.find(first_path, "//$") then | ||||
|             os.execute("mkdir -p " .. first_path) | ||||
|         local firstPath = opt[1] | ||||
|         if string.find(firstPath, "//$") then | ||||
|             os.execute("mkdir", "-p", firstPath) | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  |  | |||
							
								
								
									
										39
									
								
								vimrc
									
										
									
									
									
								
							
							
						
						
									
										39
									
								
								vimrc
									
										
									
									
									
								
							|  | @ -3,24 +3,25 @@ | |||
| 
 | ||||
| source ~/.vimrc.common | ||||
| 
 | ||||
| set nocompatible        " use enhanced vim features | ||||
| if !has('nvim') | ||||
|     set nocompatible        " use enhanced vim features | ||||
| 
 | ||||
| let s:localdir=expand("~/.local/vim") | ||||
| if !isdirectory(s:localdir) | ||||
|     call mkdir(s:localdir, "p") | ||||
|     let s:localdir=expand("~/.local/vim") | ||||
|     if !isdirectory(s:localdir) | ||||
|         call mkdir(s:localdir, "p") | ||||
|     endif | ||||
| 
 | ||||
|     let &backupdir=expand(s:localdir . "/backup//" . ",.") | ||||
|     let &undodir=expand(s:localdir . "/undo//") | ||||
|     let &viminfofile=expand(s:localdir . "/viminfo") | ||||
| 
 | ||||
|     " Shada data. Parameters as follows: (see :help shada) | ||||
|     "   %   number of buffers to save and restore when no file argument is given | ||||
|     "   '   maximum number of previously edited files for which marks are remembered | ||||
|     "   h   disable highlighted search patterns on start | ||||
|     "   /   omitted, so all search history is saved | ||||
|     "   <   maximum number of lines saved for each register | ||||
|     "   :   maximum number of lines of command history to save | ||||
|     "   s   shada entries over 100 KiB are skipped | ||||
|     set viminfo=%100,'100,h,<1000,:100,s100 | ||||
| endif | ||||
| 
 | ||||
| let &backupdir=expand(s:localdir . "/backup//" . ",.") | ||||
| let &undodir=expand(s:localdir . "/undo//") | ||||
| let &viminfofile=expand(s:localdir . "/viminfo") | ||||
| 
 | ||||
| " Shada data. Parameters as follows: (see :help shada) | ||||
| "   %   number of buffers to save and restore when no file argument is given | ||||
| "   '   maximum number of previously edited files for which marks are remembered | ||||
| "   h   disable highlighted search patterns on start | ||||
| "   /   omitted, so all search history is saved | ||||
| "   <   maximum number of lines saved for each register | ||||
| "   :   maximum number of lines of command history to save | ||||
| "   s   shada entries over 100 KiB are skipped | ||||
| set viminfo=%100,'100,h,<1000,:100,s100 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue