Code Monkey home page Code Monkey logo

dirmarks's Introduction

dirmarks

simple way change directory (cd) for windows 10 powershell and bash

dirMark for PowerShell 7 Windows 10

Added alias for PS1

Add following in ~\Document\PowerShell\Microsoft.PowerShell_profile.ps1
Set-Alias l list_dirmark
Set-Alias s save_dirmark

function list_dirmark
{
   $param1=$args[0]
      dirmark.exe -g $param1

      $lastcd = Get-Content -Path $HOME\\cddir -TotalCount 1
      if ($lastcd -eq "") {
         Write-Host "No ..." -ForegroundColor Yellow
      } else {
         cd $lastcd
      }
}

function save_dirmark
{
   $alias=$args[0]
      if ($alias)
      {
         dirmark.exe -s $alias
      } else {
         Write-Host "    +----- Save dirMarks -----" -ForegroundColor DarkGreen
            Write-Host "    l       - for list dirMarks"
            Write-Host "    s xxx   - Save comment for current Directory"
            Write-Host ""
      }
}


dirMarks.sh for bash

source ~/dirMark.sh

dirMarks

Bonus if your are using vifm https://github.com/vifm/vifm

Added following in your vifmrc which can founded in ~\AppData\Roaming\Vifm\vifmrc

nnoremap <f9> :marks<cr>
nnoremap <M-q> :execute '!pwd > c:/tmp/lastdir' | quit<cr>  "Quit vifm and store last dir in c:\tmp\lastdir  
nnoremap <M-x> :quit<cr>                                    "Cancel without change current directory

#--%<-- for Microsoft.PowerShell_profile.ps1 -->%--
Set-Alias fm vimfm_wrapper
function vifm_wrapper
{
   echo "/c" > c:/tmp/lastdir
   vifm
   $str= Get-Content 'C:\tmp\lastdir' -Tail 1
   $lastxx=$str.Split("/")
   $lastdir=$str[2..$str.Length] -join ""
   $xx=$lastxx[1] +":"+ $lastdir
   Set-Location -Path $xx
}
#--%<-- for Microsoft.PowerShell_profile.ps1 -->%--

dirmarks's People

Contributors

lecheel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.