Compare commits

..

2 commits

4 changed files with 54 additions and 10 deletions

View file

@ -1,7 +1,11 @@
[PowerShell] [PowerShell]
in="src/PowerShell/profile.ps1" in="src/PowerShell/profile.ps1"
out="~/Documents/WindowsPowerShell" out="~/Documents/WindowsPowerShell/profile.ps1"
[Git] [Git]
in="src/git/gitconfig-win" in="src/Git/gitconfig-win"
out="~/.gitconfig" out="~/.gitconfig"
[Neovim]
in="src/Neovim/init.vim"
out="~/AppData/Local/nvim/init.vim"

View file

@ -2,8 +2,4 @@ import pathlib
def get_io(conf): def get_io(conf):
_in = pathlib.Path(conf.get("in")).expanduser() return pathlib.Path(conf.get("in")).expanduser(), pathlib.Path(conf.get("out")).expanduser()
_out = pathlib.Path(conf.get("out")).expanduser()
if _out.is_dir():
_out = _out.joinpath(_in.name)
return _in, _out

View file

@ -37,11 +37,27 @@ for _name, _conf in config.items():
if not _in.is_file(): if not _in.is_file():
log.error(f"{_name} configuration <{_in}> could not be found.") log.error(f"{_name} configuration <{_in}> could not be found.")
sys.exit(1) sys.exit(1)
if _out.exists():
if _out.is_file():
_yn = input(f"<{_out}> already exists; replace [Yn] ?").strip().lower()
if _yn != "y" and _yn != "":
log.info(f"Skipping {_name} configuration.")
continue
else:
log.info(f"Installing {_name} configuration.")
else:
log.error(f"<{_out}> already exists and is not a file.")
sys.exit(1)
if not _out.parent.exists():
_out.parent.mkdir(parents=True)
elif not _out.parent.is_dir():
log.error(f"{_name} configuration could not be installed as <{_out.parent}> is not a directory.")
sys.exit(1)
try: try:
shutil.copyfile(_in, _out) shutil.copyfile(_in, _out)
except FileNotFoundError:
log.error(f"{_name} could not be configured: destination <{_out}> could not be found.")
sys.exit(1)
except OSError: except OSError:
log.error(f"{_name} could not be configured: destination <{_out}> is not writable.") log.error(f"{_name} could not be configured: destination <{_out}> is not writable.")
sys.exit(1) sys.exit(1)

28
src/Neovim/init.vim Normal file
View file

@ -0,0 +1,28 @@
"Clipboard
set clipboard+=unnamedplus
"Tabulations
set tabstop=2
set shiftwidth=2
set noexpandtab
"Mouse
set mouse=a
"Search
set ignorecase
"Completion
set wildmode=longest,list,full
"Line numbers
set number
"Text wrap
set tw=119
set cc=120
"Split side
set splitright
set splitbelow