aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 23:20:53 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 23:20:53 +0200
commit06fd119c62c96e5dcca52613940e62d6ef33962f (patch)
tree80c6c8e1b42d5b56a42988dbf5ca027477d36482
parent.vimrc: source $VIMRUNTIME/vimrc_example.vim (diff)
downloadlinux-home-06fd119c62c96e5dcca52613940e62d6ef33962f.tar.gz
linux-home-06fd119c62c96e5dcca52613940e62d6ef33962f.zip
.vimrc: add directories for backup/swap files
-rw-r--r--.vimrc44
-rw-r--r--.vimtmp/backup/.gitignore3
-rw-r--r--.vimtmp/swap/.gitignore3
-rw-r--r--.vimtmp/undo/.gitignore3
4 files changed, 46 insertions, 7 deletions
diff --git a/.vimrc b/.vimrc
index 23d5004..101e864 100644
--- a/.vimrc
+++ b/.vimrc
@@ -1,19 +1,49 @@
source $VIMRUNTIME/vimrc_example.vim
+" Color scheme.
color desert
-set expandtab
-set shiftwidth=4
+
+" 4 spaces per indentation level, no tabs.
set softtabstop=4
+set shiftwidth=4
+set expandtab
+
highlight ColorColumn ctermbg=darkgrey
+" In insert mode, press F2 to enter 'paste mode'.
+" Now you can paste text from elsewhere and _not_ mess up indentation.
+" Nice and easy, right?
+" Press F2 again to exit 'paste mode'.
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
+" Backup files are written to ~/.vimtmp/backup/.
+" I'm not sure how the whole thing's gonna work out in case of concurrent
+" writes to multiple files with the same name, since backup file names will
+" collide due to a long-standing Vim issue.
+" Vim treats `backupdir` option inconsistently: if its value ends with two
+" slashes, Vim doesn't convert the absolute path of the file being backed up
+" to its backup file name (replacing directory separators with % signs) as it
+" does with swap and 'persisent undo' files, but rather simply appends ~ to
+" the end of file's name.
+" For some reason it still works this way when there're two slashes at the
+" end, so I'm gonna stick with this, hoping that this problem gets fixed in
+" the future.
+set backupdir=~/.vimtmp/backup//
+set nobackup
+set writebackup
+
+" Swap files are written to ~/.vimrc/swap/.
+set directory=~/.vimtmp/swap//
+set swapfile
+
+" 'Persistent undo' files are written to ~/.vimrc/undo/.
+if has('persistent_undo')
+ set undodir=~/.vimtmp/undo//
+ set undofile
+endif
+
+" Enable current-directory .vimrc files.
set exrc
set secure
-
-set nobackup
-set noswapfile
-set noundofile
-set nowritebackup
diff --git a/.vimtmp/backup/.gitignore b/.vimtmp/backup/.gitignore
new file mode 100644
index 0000000..cec9082
--- /dev/null
+++ b/.vimtmp/backup/.gitignore
@@ -0,0 +1,3 @@
+*
+
+!.gitignore
diff --git a/.vimtmp/swap/.gitignore b/.vimtmp/swap/.gitignore
new file mode 100644
index 0000000..cec9082
--- /dev/null
+++ b/.vimtmp/swap/.gitignore
@@ -0,0 +1,3 @@
+*
+
+!.gitignore
diff --git a/.vimtmp/undo/.gitignore b/.vimtmp/undo/.gitignore
new file mode 100644
index 0000000..cec9082
--- /dev/null
+++ b/.vimtmp/undo/.gitignore
@@ -0,0 +1,3 @@
+*
+
+!.gitignore