]> Sergey Matveev's repositories - codecomm.git/blobdiff - plugin/codecomm.vim
Do not hardcode /tmp
[codecomm.git] / plugin / codecomm.vim
index e7d1a762ed2bd6daf2edf40fddb6d3e1f5435a06..2f108853e649de15f9d3a904caa915ada88c3ba0 100644 (file)
@@ -6,7 +6,9 @@ if exists("g:loaded_codecomm") | finish | endif
 let g:loaded_codecomm = 1
 
 if !exists("g:codecomm_file")
-    let g:codecomm_file = "/tmp/codecomm.txt"
+    let tmpdir = getenv("TMPDIR")
+    if tmpdir == v:null | let tmpdir = "/tmp" | endif
+    let g:codecomm_file = tmpdir . "/" . "codecomm.txt"
 endif
 
 if !exists("g:codecomm_count") | let g:codecomm_count = 0 | endif
@@ -52,8 +54,7 @@ function! s:CodeComm() range
     endfor
     " Spawn a new small code commenting window nonbinded to file
     new CodeCommCommenting
-    setlocal noswapfile
-    setlocal buftype=acwrite
+    setlocal noreadonly noswapfile buftype=acwrite
     call append("^", ready)
     " Separate codecomm_file consolidating function, called when buffer is saved
     autocmd! BufWriteCmd CodeCommCommenting