Skip to content

Commit

Permalink
Change g:vimshell_data_directory default value
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Feb 3, 2014
1 parent a93ddae commit 9d9b8a5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
13 changes: 8 additions & 5 deletions autoload/vimshell.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: vimshell.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 06 Jan 2014.
" Last Modified: 04 Feb 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -32,7 +32,7 @@ if !exists('g:loaded_vimshell')
endif

function! vimshell#version() "{{{
return str2nr(printf('%02d%02d', 11, 0))
return str2nr(printf('%02d%02d', 11, 1))
endfunction"}}}

function! vimshell#echo_error(string) "{{{
Expand Down Expand Up @@ -123,11 +123,14 @@ function! vimshell#is_interactive() "{{{
\ || (b:interactive.type ==# 'vimshell' && is_valid)
endfunction"}}}
function! vimshell#get_data_directory()
if !isdirectory(g:vimshell_temporary_directory) && !vimshell#util#is_sudo()
call mkdir(g:vimshell_temporary_directory, 'p')
let data_directory = vimshell#util#substitute_path_separator(
\ vimshell#util#set_default('g:vimshell_temporary_directory',
\ expand('~/.cache/vimshell'), 'g:vimshell_temporary_directory'))
if !isdirectory(data_directory) && !vimshell#util#is_sudo()
call mkdir(data_directory, 'p')
endif

return g:vimshell_temporary_directory
return data_directory
endfunction
"}}}

Expand Down
12 changes: 11 additions & 1 deletion autoload/vimshell/util.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: util.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 01 Jan 2014.
" Last Modified: 04 Feb 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -115,6 +115,16 @@ function! vimshell#util#expand(path) "{{{
\ '^\$\h\w*', '\=eval(submatch(0))', '') :
\ a:path)
endfunction"}}}
function! vimshell#util#set_default(var, val, ...) "{{{
if !exists(a:var) || type({a:var}) != type(a:val)
let alternate_var = get(a:000, 0, '')

let {a:var} = exists(alternate_var) ?
\ {alternate_var} : a:val
endif

return {a:var}
endfunction"}}}
function! vimshell#util#set_default_dictionary_helper(variable, keys, value) "{{{
for key in split(a:keys, '\s*,\s*')
if !has_key(a:variable, key)
Expand Down
13 changes: 8 additions & 5 deletions doc/vimshell.txt
@@ -1,6 +1,6 @@
*vimshell.txt* Powerful shell implemented by Vim script

Version: 11.0
Version: 11.1
Author : Shougo <Shougo.Matsu@gmail.com>
License: MIT license {{{
Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -241,11 +241,14 @@ g:vimshell_use_terminal_command

Initial value is an empty string.

g:vimshell_temporary_directory *g:vimshell_temporary_directory*
Sets a temporary directory used by vimshell. And history file
is saved in this directory.
g:vimshell_data_directory *g:vimshell_data_directory*
Specify directories to store vimshell configurations. And
history file is saved in this directory.

Initial value is "expand('~/.cache/vimshell')".

Initial value is "expand('~/.vimshell')".
g:vimshell_temporary_directory *g:vimshell_temporary_directory*
Note: It is deprecated name.

g:vimshell_max_command_history *g:vimshell_max_command_history*
Maximum number of entries in history.
Expand Down
6 changes: 1 addition & 5 deletions plugin/vimshell.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: vimshell.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 03 Feb 2014.
" Last Modified: 04 Feb 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -41,10 +41,6 @@ let g:vimshell_enable_debug =
\ get(g:, 'vimshell_enable_debug', 0)
let g:vimshell_use_terminal_command =
\ get(g:, 'vimshell_use_terminal_command', '')
let g:vimshell_temporary_directory =
\ substitute(fnamemodify(get(
\ g:, 'vimshell_temporary_directory', '~/.vimshell'),
\ ':p'), '\\', '/', 'g')
let g:vimshell_max_command_history =
\ get(g:, 'vimshell_max_command_history', 1000)
let g:vimshell_max_directory_stack =
Expand Down

0 comments on commit 9d9b8a5

Please sign in to comment.