Add a new command and script to open a file via dmenu app
This commit is contained in:
parent
01db97eb7c
commit
cf9e26041f
@ -24,3 +24,9 @@ map <f2> :NERDTreeToggle<CR>
|
|||||||
let g:UltiSnipsExpandTrigger="<tab>"
|
let g:UltiSnipsExpandTrigger="<tab>"
|
||||||
let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
||||||
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
||||||
|
|
||||||
|
"
|
||||||
|
" DMenu file opening
|
||||||
|
"
|
||||||
|
map <c-t> :call DmenuOpen("tabe")<CR>
|
||||||
|
map <c-f> :call DmenuOpen("e")<CR>
|
||||||
|
27
vim/vim/scripts.vim
Normal file
27
vim/vim/scripts.vim
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" ____ ____ ____ ___ ____ _____ ____
|
||||||
|
" / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
||||||
|
" \___ \| | | |_) || || |_) || | \___ \
|
||||||
|
" ___) | |___| _ < | || __/ | | ___) |
|
||||||
|
:" |____/ \____|_| \_\___|_| |_| |____/
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" File opening scripts using DMenu
|
||||||
|
"
|
||||||
|
" Strip the newline from the end of a string
|
||||||
|
function! Chomp(str)
|
||||||
|
return substitute(a:str, '\n$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find a file and pass it to cmd
|
||||||
|
function! DmenuOpen(cmd)
|
||||||
|
let fname = Chomp(system("git ls-files | dmenu -i -l 20 -p " . a:cmd))
|
||||||
|
if empty(fname)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
execute a:cmd . " " . fname
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
25
vim/vimrc
25
vim/vimrc
@ -32,7 +32,7 @@ set nowrap
|
|||||||
cnoremap w!! w !sudo tee > /dev/null %
|
cnoremap w!! w !sudo tee > /dev/null %
|
||||||
|
|
||||||
" Start in insert mode for ALL files
|
" Start in insert mode for ALL files
|
||||||
"au BufRead,BufNewFile * startinsert
|
au BufRead,BufNewFile * startinsert
|
||||||
"startinsert
|
"startinsert
|
||||||
|
|
||||||
|
|
||||||
@ -75,10 +75,14 @@ let g:lightline = {
|
|||||||
\ 'colorscheme': 'jellybeans',
|
\ 'colorscheme': 'jellybeans',
|
||||||
\ 'active': {
|
\ 'active': {
|
||||||
\ 'left': [ [ 'mode', 'paste' ],
|
\ 'left': [ [ 'mode', 'paste' ],
|
||||||
\ [ 'readonly', 'filename', 'modified' ] ]
|
\ [ 'readonly', 'filename', 'modified' ] ],
|
||||||
|
\ 'right': [ [ 'lineinfo' ],
|
||||||
|
\ [ 'percent' ],
|
||||||
|
\ [ 'fileformat', 'fileencoding', 'filetype', 'kitestatus' ] ],
|
||||||
\ },
|
\ },
|
||||||
\ 'component': {
|
\ 'component': {
|
||||||
\ 'readonly': '%{&readonly?"⭤":""}',
|
\ 'readonly': '%{&readonly?"⭤":""}',
|
||||||
|
\ 'kitestatus': '%{kite#statusline()}',
|
||||||
\ },
|
\ },
|
||||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||||
@ -125,13 +129,26 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" ____ ____ ____ ___ ____ _____ ____
|
||||||
|
" / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
||||||
|
" \___ \| | | |_) || || |_) || | \___ \
|
||||||
|
" ___) | |___| _ < | || __/ | | ___) |
|
||||||
|
" |____/ \____|_| \_\___|_| |_| |____/
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Load scripts from file
|
||||||
|
source $HOME/.vim/scripts.vim
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____
|
" _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____
|
||||||
" | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___|
|
" | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___|
|
||||||
" | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \
|
" | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \
|
||||||
" | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) |
|
" | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) |
|
||||||
" |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
|
" |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
|
||||||
"
|
"
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Load keybindings from file
|
" Load keybindings from file
|
||||||
source $HOME/.vim/keybindings.vim
|
source $HOME/.vim/keybindings.vim
|
||||||
|
Loading…
Reference in New Issue
Block a user