Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhuster committed Nov 25, 2024
1 parent f9e2978 commit d33c225
Show file tree
Hide file tree
Showing 11 changed files with 603 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/actions/commit-and-push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Commit and Push'
description: 'Commit and push changes to the repository'
inputs:
commit-message:
description: 'Commit message'
required: true
files:
description: 'Files to add'
required: true
github_token:
description: 'GitHub token'
required: true
runs:
using: 'composite'
steps:
- name: Commit and Push
shell: bash
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ inputs.github_token }}@github.com/${{ github.repository }}.git
git add ${{ inputs.files }}
git diff --quiet && git diff --staged --quiet || (git commit -m "${{ inputs.commit-message }}"; git pull --rebase; git push)
29 changes: 29 additions & 0 deletions .github/workflows/panvimdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: panvimdoc

on:
push:
branches:
- '*'

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
name: pandoc to vimdoc
steps:
- uses: actions/checkout@v2
- uses: kdheepak/panvimdoc@main
with:
vimdoc: 'dirvish-do'
pandoc: 'README.md'
description: '*dirvish-do*'

- name: Commit and push documentation
uses: ./.github/actions/commit-and-push
with:
commit-message: 'Update Vimdoc based on README'
files: 'doc/*'
github_token: ${{ secrets.GITHUB_TOKEN }}

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Phạm Bình An

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
157 changes: 157 additions & 0 deletions doc/dirvish-do.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
*dirvish-dovish.txt* *dirvish-dovish*

==============================================================================
Table of Contents *dirvish-dovish-table-of-contents*

1. Introduction |dirvish-dovish-introduction|
2. Features |dirvish-dovish-features|
3. Installation & Requirements |dirvish-dovish-installation-&-requirements|
4. Configuration |dirvish-dovish-configuration|
- In Lua |dirvish-dovish-configuration-in-lua|
- In Vimscript |dirvish-dovish-configuration-in-vimscript|
5. Usage |dirvish-dovish-usage|
- Keymaps |dirvish-dovish-usage-keymaps|
- Tips |dirvish-dovish-usage-tips|
6. Credit |dirvish-dovish-credit|

==============================================================================
1. Introduction *dirvish-dovish-introduction*


The file manipulation commands for vim-dirvish
<https://github.com/justinmk/vim-dirvish> that you’ve always wanted

==============================================================================
2. Features *dirvish-dovish-features*

- Supports most file operations: create, delete, rename, copy, move
- Cross-platform support thanks to luv <https://github.com/luvit/luv>
- Easy to memorize |dirvish-dovish-mappings|
- Integration with LSP for renaming files,…


==============================================================================
3. Installation & Requirements *dirvish-dovish-installation-&-requirements*

You’ll need: - Nvim 0.8 or later - dirvish.vim
<https://github.com/justinmk/vim-dirvish>

Then install with your favorite package manager:

>lua
-- lazy.nvim
{
'brianhuster/dirvish-do.nvim',
dependencies = {'justinmk/vim-dirvish'}
}
<

>vim
" Vim-Plug
Plug 'justinmk/vim-dirvish'
Plug 'brianhuster/dirvish-do.nvim'
<


==============================================================================
4. Configuration *dirvish-dovish-configuration*

You can configure the keymaps to your liking. Here’s an example:


IN LUA *dirvish-dovish-configuration-in-lua*

>lua
require('dirvish-do').setup(){
keymaps = {
make_file = 'mf',
make_dir = 'md',
copy = 'cp',
move = 'mv',
rename = 'r',
remove = '<Del>',
},
})
<


IN VIMSCRIPT *dirvish-dovish-configuration-in-vimscript*

>vim
v:lua.require'dirvish-do'.setup(#{
\ keymaps: {
\ make_file: 'mf',
\ make_dir: 'md',
\ copy: 'cp',
\ move: 'mv',
\ move: 'r',
\ remove: '<Del>',
\ },
\ })
<

See |v:lua-call| for more information on calling Lua functions from legacy
Vimscript.


==============================================================================
5. Usage *dirvish-dovish-usage*


KEYMAPS *dirvish-dovish-usage-keymaps*

Below are the default keymaps. You can change them in the
|dirvish-dovish-configuration|

--------------------------------------------------------------------------------
Function Default Mode Tip to remember
----------------------------------- --------- -------- -------------------------
Create file mf Normal mf for “make file”

Create directory md Normal md for “make directory”

Delete under cursor <Del> Normal Just delete key

Delete items in visual selection <Del> Visual Just delete key

Rename under cursor r Normal r for “rename”

Copy file to current directory cp Normal cp for “copy”

Move file to current directory mv Normal mv for “move”
--------------------------------------------------------------------------------
For example, you can use `yy` to yank a file, then move to a new directory and
use `p` to paste the file there. Or to move a file, you use `yy` to yank the
file, move to a new directory and use `mv` to move the file there.

You can also use `y` in `visual line` mode to select many files to copy or
move. (Note: `visual line` mode is recommended so that you can yank the full
file path)


TIPS *dirvish-dovish-usage-tips*

- Run |dirvish-do| to see the help file generated from this README
- Use `:checkhealth dirvish-do` to check your keymaps and configuration


==============================================================================
6. Credit *dirvish-dovish-credit*

This is a fork of vim-dirvish-dovish
<https://github.com/roginfarrer/vim-dirvish-dovish> by Rogin Farrer that has
been rewritten in Lua. It uses |luv| and |built-in| Vim commands and functions
instead of shell commands for better cross-platform support out of the box.

Thanks to Anton Kavalkou
<https://github.com/antosha417/nvim-lsp-file-operations> for the inspiration
and the idea to integrate with LSP

Big shout out to Melandel <https://github.com/Melandel> for laying the
foundation
<https://github.com/Melandel/desktop/blob/c323969e4bd48dda6dbceada3a7afe8bacdda0f5/setup/my_vimrc.vim#L976-L1147>
for this plugin!

Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
9 changes: 9 additions & 0 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dirvish-dovish dirvish-dovish.txt /*dirvish-dovish*
dirvish-dovish-configuration dirvish-dovish.txt /*dirvish-dovish-configuration*
dirvish-dovish-credit dirvish-dovish.txt /*dirvish-dovish-credit*
dirvish-dovish-installation-&-requirements dirvish-dovish.txt /*dirvish-dovish-installation-&-requirements*
dirvish-dovish-introduction dirvish-dovish.txt /*dirvish-dovish-introduction*
dirvish-dovish-mappings dirvish-dovish.txt /*dirvish-dovish-mappings*
dirvish-dovish-table-of-contents dirvish-dovish.txt /*dirvish-dovish-table-of-contents*
dirvish-dovish-todo dirvish-dovish.txt /*dirvish-dovish-todo*
dirvish-dovish.txt dirvish-dovish.txt /*dirvish-dovish.txt*
16 changes: 16 additions & 0 deletions ftplugin/dirvish.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if vim.fn.has('nvim-0.8') == 0 then
vim.notify('dirvish-do.nvim only supports Nvim 0.8 and later', vim.log.levels.ERROR)
return
end

local map = vim.keymap.set
local dirvido = require('dirvish-do')
local keymaps = dirvido.config.keymaps

map({ 'n' }, keymaps.copy, dirvido.copy, { buffer = true, silent = true })
map({ 'n' }, keymaps.move, dirvido.move, { buffer = true, silent = true })
map({ 'n' }, keymaps.rename, dirvido.rename, { buffer = true, silent = true })
map({ 'n' }, keymaps.remove, dirvido.nremove, { buffer = true, silent = true })
map({ 'x' }, keymaps.remove, dirvido.vremove, { buffer = true, silent = true })
map({ 'n' }, keymaps.make_file, dirvido.mkfile, { buffer = true, silent = true })
map({ 'n' }, keymaps.make_dir, dirvido.mkdir, { buffer = true, silent = true })
3 changes: 3 additions & 0 deletions lua/dirvish-do/compat.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if not vim.lsp.get_clients then
vim.lsp.get_clients = vim.lsp.get_active_clients
end
23 changes: 23 additions & 0 deletions lua/dirvish-do/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local health = vim.health
local M = {}

function M.check()
health.start('Check requirements')
if vim.fn.has('nvim-0.8') == 0 then
health.error('dirvish-dovish.nvim only supports Nvim 0.8 and later')
return
end
health.ok('Your Neovim version is supported')

if not pcall(vim.fn["dirvish#remove_icon_fn"], -1) then
health.warn('vim-dirvish not installed',
'Get it at `https://github.com/justinmk/vim-dirvish`')
else
health.ok('vim-dirvish is installed')
end

health.start('Check your config')
health.info(vim.inspect(require('dirvish-do').config))
end

return M
Loading

0 comments on commit d33c225

Please sign in to comment.