This commit is contained in:
jay 2022-04-14 21:30:31 +08:00
parent d05f210541
commit 152c6da25a
4 changed files with 151 additions and 85 deletions

View File

@ -0,0 +1,9 @@
includes = []
packages = ["shell", "zsh", "vim", "nvim", "zsh_zinit"]
[variables]
js_linter = "\"eslint\""
js_fixer = "\"prettier\""
email = "jay@lawsnote.com"
git_username = "jay"

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.dotter/local.toml
.dotter/cache/
.dotter/cache.toml
.DS_Store

View File

@ -42,19 +42,20 @@ Plug 'pangloss/vim-javascript'
" golang install go get -u github.com/jstemmer/gotags
Plug 'majutsushi/tagbar'
Plug 'w0rp/ale'
Plug 'connorholyday/vim-snazzy'
Plug 'hzchirs/vim-material'
Plug 'kadekillary/Turtles'
Plug 'phanviet/vim-monokai-pro'
Plug 'sickill/vim-monokai'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" defx file explorer
" require python package pynvim
" install `pip3 install --user pynvim`
Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
" Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
Plug 'vim-airline/vim-airline'
Plug 'kien/tabman.vim'
@ -104,11 +105,14 @@ set nowrap
set backspace=indent,eol,start
set encoding=utf-8
set completeopt=menu,menuone,noselect
set noswapfile
" set guifont=Hack\ Nerd\ Font:h11
set background=dark
set termguicolors
function! AdaptColorscheme()
highlight clear CursorLine
highlight Normal ctermbg=none
@ -140,9 +144,22 @@ nmap <leader>sws <c-w>j
nmap <leader>swa <c-w>h
nmap <leader>swd <c-w>l
nnoremap <leader>fl :Lines
nnoremap <leader>fb :BLines
nnoremap <leader>ff :Files
nnoremap <leader>fg :GFiles
nnoremap <leader>f? :GFiles?
nnoremap <leader>ft :Tags<cr>
nnoremap <leader>fa :Ag
nnoremap <leader>fc :Commits
nmap <leader>aa gT
nmap <leader>dd gt
nnoremap <leader>me :NvimTreeToggle<CR>
nnoremap <F3> :NvimTreeToggle<CR>
function! TabCloseRight(bang)
let cur=tabpagenr()
while cur < tabpagenr('$')
@ -159,81 +176,6 @@ endfunction
command! -bang Tabcloseright call TabCloseRight('<bang>')
command! -bang Tabcloseleft call TabCloseLeft('<bang>')
" defx settings
call defx#custom#option('_', {
\ 'winwidth': 40,
\ 'split': 'vertical',
\ 'direction': 'topleft',
\ 'buffer_name': '',
\ 'toggle': 1,
\ 'resume': 1,
\ })
nmap <F3> :Defx<CR>
nmap <leader>me :Defx<CR>
autocmd FileType defx call s:defx_my_settings()
function! s:defx_my_settings() abort
" Define mappings
nnoremap <silent><buffer><expr> <CR>
\ defx#is_directory() ?
\ defx#do_action('open_tree', 'toggle') :
\ defx#do_action('drop')
nnoremap <silent><buffer><expr> T
\ defx#do_action('open', 'tabe')
nnoremap <silent><buffer><expr> s
\ defx#do_action('drop', 'vsplit')
nnoremap <silent><buffer><expr> mc
\ defx#do_action('copy')
nnoremap <silent><buffer><expr> mm
\ defx#do_action('move')
nnoremap <silent><buffer><expr> mp
\ defx#do_action('paste')
nnoremap <silent><buffer><expr> P
\ defx#do_action('preview')
nnoremap <silent><buffer><expr> o
\ defx#do_action('open_tree', 'toggle')
nnoremap <silent><buffer><expr> ma
\ defx#do_action('new_file')
nnoremap <silent><buffer><expr> C
\ defx#do_action('toggle_columns',
\ 'mark:indent:icon:filename:type:size:time')
nnoremap <silent><buffer><expr> S
\ defx#do_action('toggle_sort', 'time')
nnoremap <silent><buffer><expr> md
\ defx#do_action('remove')
nnoremap <silent><buffer><expr> mr
\ defx#do_action('rename')
nnoremap <silent><buffer><expr> !
\ defx#do_action('execute_command')
nnoremap <silent><buffer><expr> x
\ defx#do_action('execute_system')
nnoremap <silent><buffer><expr> yy
\ defx#do_action('yank_path')
nnoremap <silent><buffer><expr> .
\ defx#do_action('toggle_ignored_files')
nnoremap <silent><buffer><expr> ;
\ defx#do_action('repeat')
nnoremap <silent><buffer><expr> h
\ defx#do_action('cd', ['..'])
nnoremap <silent><buffer><expr> ~
\ defx#do_action('cd')
nnoremap <silent><buffer><expr> q
\ defx#do_action('quit')
nnoremap <silent><buffer><expr> <Space>
\ defx#do_action('toggle_select') . 'j'
nnoremap <silent><buffer><expr> *
\ defx#do_action('toggle_select_all')
nnoremap <silent><buffer><expr> j
\ line('.') == line('$') ? 'gg' : 'j'
nnoremap <silent><buffer><expr> k
\ line('.') == 1 ? 'G' : 'k'
nnoremap <silent><buffer><expr> r
\ defx#do_action('redraw')
nnoremap <silent><buffer><expr> <C-g>
\ defx#do_action('print')
nnoremap <silent><buffer><expr> cd
\ defx#do_action('change_vim_cwd')
endfunction
" tagbar
nmap <F8> :TagbarToggle<CR>
nmap <F9> :%!jq .<CR>
@ -300,7 +242,6 @@ let g:tagbar_type_go = {
\ }
" vim-go setting
autocmd FileType go nmap tgd <Plug>(go-def-tab)
autocmd FileType go nmap <leader>err <Plug>(go-iferr)
let g:go_fmt_fail_silently = 1
let g:go_fmt_command = "goimports"
@ -341,6 +282,38 @@ let g:multi_cursor_quit_key = '<Esc>'
let g:javascript_plugin_jsdoc = 1
" fzf settings
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
lua << EOF
local nvlsp = require'lspconfig'
@ -366,7 +339,7 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<leader>gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', '<leader>gt', '<cmd>tab split<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<leader>gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
@ -422,5 +395,87 @@ cmp.setup {
}),
}
EOF
require'nvim-tree'.setup {
auto_reload_on_write = true,
disable_netrw = false,
hide_root_folder = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = false,
view = {
width = 40,
height = 40,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = false,
list = {
-- user mappings go here
},
},
},
renderer = {
indent_markers = {
enable = false,
icons = {
corner = "└ ",
edge = "│ ",
none = " ",
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = nil,
args = {},
},
filters = {
dotfiles = false,
custom = {},
exclude = {},
},
git = {
enable = true,
ignore = true,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
}
EOF

View File

@ -43,4 +43,5 @@ zinit light "tinyRatP/ys"
# vim: set ft=zsh:
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh