-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateConfigs.hs
executable file
·46 lines (36 loc) · 1.24 KB
/
UpdateConfigs.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env stack
-- stack --resolver lts-10.2 script
{-# LANGUAGE OverloadedStrings #-} --
--
import Control.Monad (liftM2)
import Data.Monoid ((<>))
import Filesystem.Path (filename)
import Filesystem.Path.CurrentOS (decodeString, encodeString)
import Prelude hiding (FilePath)
import System.Directory (getHomeDirectory)
import Turtle (FilePath, cp)
main = do
copyVimrc
copyPluginsVim
copyMappingsVim
copyKittyConf
copyVimrc :: IO ()
copyVimrc = cpDotfile (fromHome ".vimrc")
copyPluginsVim :: IO ()
copyPluginsVim = cpDotfile (fromHome ".plugins.vim")
copyMappingsVim :: IO ()
copyMappingsVim = cpDotfile (fromHome ".mappings.vim")
copyKittyConf :: IO ()
copyKittyConf = cpDotfile (fromHome ".config/kitty/kitty.conf")
dotfilesDir :: IO FilePath
dotfilesDir =
(<> decodeString "dotfiles/") <$> (decodeString <$> getHomeDirectory)
fromHome :: String -> IO FilePath
fromHome name = (<> decodeString name) <$> (decodeString <$> getHomeDirectory)
fromDotfiles :: String -> IO FilePath
fromDotfiles name = (<> decodeString name) <$> dotfilesDir
cpDotfile :: IO FilePath -> IO ()
cpDotfile originalPath = do
fromPath <- originalPath
to <- (fromDotfiles . encodeString $ filename fromPath)
cp fromPath to