diff --git a/.dotter/local.toml.example b/.dotter/local.toml.example new file mode 100644 index 0000000..fedf856 --- /dev/null +++ b/.dotter/local.toml.example @@ -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" diff --git a/.gitignore b/.gitignore index 90a3907..a0dcc5c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .dotter/local.toml .dotter/cache/ .dotter/cache.toml +.DS_Store diff --git a/nvim/init.vim b/nvim/init.vim index d86b3df..197aa78 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -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 sws j nmap swa h nmap swd l +nnoremap fl :Lines +nnoremap fb :BLines +nnoremap ff :Files +nnoremap fg :GFiles +nnoremap f? :GFiles? +nnoremap ft :Tags +nnoremap fa :Ag +nnoremap fc :Commits + nmap aa gT nmap dd gt +nnoremap me :NvimTreeToggle +nnoremap :NvimTreeToggle + + function! TabCloseRight(bang) let cur=tabpagenr() while cur < tabpagenr('$') @@ -159,81 +176,6 @@ endfunction command! -bang Tabcloseright call TabCloseRight('') command! -bang Tabcloseleft call TabCloseLeft('') -" defx settings -call defx#custom#option('_', { - \ 'winwidth': 40, - \ 'split': 'vertical', - \ 'direction': 'topleft', - \ 'buffer_name': '', - \ 'toggle': 1, - \ 'resume': 1, - \ }) -nmap :Defx -nmap me :Defx -autocmd FileType defx call s:defx_my_settings() -function! s:defx_my_settings() abort - " Define mappings - nnoremap - \ defx#is_directory() ? - \ defx#do_action('open_tree', 'toggle') : - \ defx#do_action('drop') - nnoremap T - \ defx#do_action('open', 'tabe') - nnoremap s - \ defx#do_action('drop', 'vsplit') - nnoremap mc - \ defx#do_action('copy') - nnoremap mm - \ defx#do_action('move') - nnoremap mp - \ defx#do_action('paste') - nnoremap P - \ defx#do_action('preview') - nnoremap o - \ defx#do_action('open_tree', 'toggle') - nnoremap ma - \ defx#do_action('new_file') - nnoremap C - \ defx#do_action('toggle_columns', - \ 'mark:indent:icon:filename:type:size:time') - nnoremap S - \ defx#do_action('toggle_sort', 'time') - nnoremap md - \ defx#do_action('remove') - nnoremap mr - \ defx#do_action('rename') - nnoremap ! - \ defx#do_action('execute_command') - nnoremap x - \ defx#do_action('execute_system') - nnoremap yy - \ defx#do_action('yank_path') - nnoremap . - \ defx#do_action('toggle_ignored_files') - nnoremap ; - \ defx#do_action('repeat') - nnoremap h - \ defx#do_action('cd', ['..']) - nnoremap ~ - \ defx#do_action('cd') - nnoremap q - \ defx#do_action('quit') - nnoremap - \ defx#do_action('toggle_select') . 'j' - nnoremap * - \ defx#do_action('toggle_select_all') - nnoremap j - \ line('.') == line('$') ? 'gg' : 'j' - nnoremap k - \ line('.') == 1 ? 'G' : 'k' - nnoremap r - \ defx#do_action('redraw') - nnoremap - \ defx#do_action('print') - nnoremap cd - \ defx#do_action('change_vim_cwd') -endfunction - " tagbar nmap :TagbarToggle nmap :%!jq . @@ -300,7 +242,6 @@ let g:tagbar_type_go = { \ } " vim-go setting -autocmd FileType go nmap tgd (go-def-tab) autocmd FileType go nmap err (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 = '' 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', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'gt', 'tab splitlua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - -- buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) -- buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', 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 diff --git a/zshrc_zinit b/zshrc_zinit index 94072e4..1735208 100644 --- a/zshrc_zinit +++ b/zshrc_zinit @@ -43,4 +43,5 @@ zinit light "tinyRatP/ys" # vim: set ft=zsh: -# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh