diff --git a/.config/nvim/after/plugin/defx.rc.vim b/.config/nvim/after/plugin/defx.rc.vim index 3ab5c05..356ad77 100644 --- a/.config/nvim/after/plugin/defx.rc.vim +++ b/.config/nvim/after/plugin/defx.rc.vim @@ -1,67 +1,67 @@ -nnoremap d Defx `escape(expand('%:p:h'), ' :')` -search=`expand('%:p')` -split=vertical -winwidth=50 -direction=topleft - -autocmd FileType defx call s:defx_my_settings() -function! s:defx_my_settings() abort - " Define mappings - nnoremap - \ defx#do_action('drop') " instead of open - nnoremap c - \ defx#do_action('copy') - nnoremap m - \ defx#do_action('move') - nnoremap p - \ defx#do_action('paste') - nnoremap l - \ defx#do_action('drop') - nnoremap E - \ defx#do_action('open', 'vsplit') - nnoremap P - \ defx#do_action('preview') - nnoremap o - \ defx#do_action('open_tree', 'toggle') - nnoremap K - \ defx#do_action('new_directory') - nnoremap N - \ defx#do_action('new_file') - nnoremap M - \ defx#do_action('new_multiple_files') - nnoremap C - \ defx#do_action('toggle_columns', - \ 'mark:indent:icon:filename:type:size:time') - nnoremap S - \ defx#do_action('toggle_sort', 'time') - nnoremap d - \ defx#do_action('remove') - nnoremap r - \ 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 - \ defx#do_action('redraw') - nnoremap - \ defx#do_action('print') - nnoremap cd - \ defx#do_action('change_vim_cwd') -endfunction +"nnoremap d Defx `escape(expand('%:p:h'), ' :')` -search=`expand('%:p')` -split=vertical -winwidth=50 -direction=topleft +" +"autocmd FileType defx call s:defx_my_settings() +"function! s:defx_my_settings() abort +" " Define mappings +" nnoremap +" \ defx#do_action('drop') " instead of open +" nnoremap c +" \ defx#do_action('copy') +" nnoremap m +" \ defx#do_action('move') +" nnoremap p +" \ defx#do_action('paste') +" nnoremap l +" \ defx#do_action('drop') +" nnoremap E +" \ defx#do_action('open', 'vsplit') +" nnoremap P +" \ defx#do_action('preview') +" nnoremap o +" \ defx#do_action('open_tree', 'toggle') +" nnoremap K +" \ defx#do_action('new_directory') +" nnoremap N +" \ defx#do_action('new_file') +" nnoremap M +" \ defx#do_action('new_multiple_files') +" nnoremap C +" \ defx#do_action('toggle_columns', +" \ 'mark:indent:icon:filename:type:size:time') +" nnoremap S +" \ defx#do_action('toggle_sort', 'time') +" nnoremap d +" \ defx#do_action('remove') +" nnoremap r +" \ 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 +" \ defx#do_action('redraw') +" nnoremap +" \ defx#do_action('print') +" nnoremap cd +" \ defx#do_action('change_vim_cwd') +"endfunction diff --git a/.config/nvim/after/plugin/fzf.rc.vim b/.config/nvim/after/plugin/fzf.rc.vim index 59b7713..2a6cb0a 100644 --- a/.config/nvim/after/plugin/fzf.rc.vim +++ b/.config/nvim/after/plugin/fzf.rc.vim @@ -1,10 +1,10 @@ -nnoremap a :Rg! -nnoremap A :Rg! -nnoremap b :Buffers -nnoremap c :Commands! -nnoremap g :Commits! -nnoremap f :Files! -nnoremap H :History/ -nnoremap H :History! -nnoremap l :Lines! -inoremap s :Snippets! +"nnoremap a :Rg! +"nnoremap A :Rg! +"nnoremap b :Buffers! +"nnoremap c :Commands! +"nnoremap g :Commits! +"nnoremap f :Files! +"nnoremap H :History/ +"nnoremap H :History! +"nnoremap l :Lines! +"inoremap s :Snippets! diff --git a/.config/nvim/after/plugin/lspconfig.rc.vim b/.config/nvim/after/plugin/lspconfig.rc.vim index 95f6c27..e2031ca 100644 --- a/.config/nvim/after/plugin/lspconfig.rc.vim +++ b/.config/nvim/after/plugin/lspconfig.rc.vim @@ -7,16 +7,16 @@ lua << EOF local nvim_lsp = require'lspconfig' local coq = require'coq' local cmp = require'cmp_nvim_lsp' -local signature = require'lsp_signature' +--local signature = require'lsp_signature' local illuminate = require'illuminate' -- Mappings. local opts = { noremap=true, silent=true } -vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) +vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) -vim.api.nvim_set_keymap('n', 'E', 'lua vim.diagnostic.set_loclist()', opts) -vim.api.nvim_set_keymap("n", "q", "lua vim.lsp.buf.formatting()", opts) +vim.api.nvim_set_keymap('n', 'E', 'lua vim.diagnostic.set_loclist()', opts) +vim.api.nvim_set_keymap("n", "q", "lua vim.lsp.buf.formatting()", opts) -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer @@ -30,20 +30,20 @@ local on_attach = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - signature.on_attach({ - bind = true, - handler_opts = { - border = "single", - } - }, bufnr) + -- signature.on_attach({ + -- bind = true, + -- handler_opts = { + -- border = "single", + -- } + -- }, bufnr) illuminate.on_attach(client) end diff --git a/.config/nvim/after/plugin/nerdtree.rc.vim b/.config/nvim/after/plugin/nerdtree.rc.vim index c16ac31..2cd1225 100644 --- a/.config/nvim/after/plugin/nerdtree.rc.vim +++ b/.config/nvim/after/plugin/nerdtree.rc.vim @@ -1,3 +1,3 @@ " Mapping to NERDTree -nnoremap t :NERDTreeToggle -let NERDTreeIgnore=['\~$', '\.pyc$'] +"nnoremap t :NERDTreeToggle +"let NERDTreeIgnore=['\~$', '\.pyc$'] diff --git a/.config/nvim/after/plugin/nvim-cmp.rc.vim b/.config/nvim/after/plugin/nvim-cmp.rc.vim index 6115f05..c9b9a3d 100644 --- a/.config/nvim/after/plugin/nvim-cmp.rc.vim +++ b/.config/nvim/after/plugin/nvim-cmp.rc.vim @@ -17,10 +17,10 @@ cmp.setup({ end, }, mapping = { - [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close(), diff --git a/.config/nvim/after/plugin/nvim-tree.rc.vim b/.config/nvim/after/plugin/nvim-tree.rc.vim new file mode 100644 index 0000000..7c61ead --- /dev/null +++ b/.config/nvim/after/plugin/nvim-tree.rc.vim @@ -0,0 +1,139 @@ +let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file +let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open +let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). +let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories. +let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options +let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names +let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree +let g:nvim_tree_change_dir_global = 1 "0 by default, use :cd when changing directories. +let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker. +let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. +let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target. +let g:nvim_tree_respect_buf_cwd = 0 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. +let g:nvim_tree_create_in_closed_folder = 0 "1 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1. +let g:nvim_tree_refresh_wait = 1000 " control how often the tree can be refreshed, 1000 means the tree can be refresh once per 1000ms. +let g:nvim_tree_window_picker_exclude = { + \ 'filetype': [ + \ 'notify', + \ 'packer', + \ 'qf' + \ ], + \ 'buftype': [ + \ 'terminal' + \ ] + \ } +" Dictionary of buffer option names mapped to a list of option values that +" indicates to the window picker that the buffer's window should not be +" selectable. +let g:nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1 } " List of filenames that gets highlighted with NvimTreeSpecialFile +let g:nvim_tree_show_icons = { + \ 'git': 1, + \ 'folders': 1, + \ 'files': 1, + \ 'folder_arrows': 0, + \ } +"If 0, do not show the icons for one of 'git' 'folder' and 'files' +"1 by default, notice that if 'files' is 1, it will only display +"if nvim-web-devicons is installed and on your runtimepath. +"if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons. +"but this will not work when you set indent_markers (because of UI conflict) + +" default will show icon by default if no icon is provided +" default shows no icon by default +let g:nvim_tree_icons = { + \ 'default': '', + \ 'symlink': '', + \ 'git': { + \ 'unstaged': "✗", + \ 'staged': "✓", + \ 'unmerged': "", + \ 'renamed': "➜", + \ 'untracked': "★", + \ 'deleted': "", + \ 'ignored': "◌" + \ }, + \ 'folder': { + \ 'arrow_open': "", + \ 'arrow_closed': "", + \ 'default': "", + \ 'open': "", + \ 'empty': "", + \ 'empty_open': "", + \ 'symlink': "", + \ 'symlink_open': "", + \ } + \ } + +nnoremap tt :NvimTreeToggle +"nnoremap r :NvimTreeRefresh +nnoremap tf :NvimTreeFindFile +" NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize are also available if you need them + +"set termguicolors " this variable must be enabled for colors to be applied properly + +" a list of groups can be found at `:help nvim_tree_highlight` +"highlight NvimTreeFolderIcon guibg=blue + +lua << EOF +-- following options are the default +-- each of these are documented in `:help nvim-tree.OPTION_NAME` +require'nvim-tree'.setup { + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = {}, + auto_close = false, + open_on_tab = false, + hijack_cursor = false, + update_cwd = false, + update_to_buf_dir = { + enable = true, + auto_open = true, + }, + diagnostics = { + enable = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + } + }, + update_focused_file = { + enable = false, + update_cwd = false, + ignore_list = {} + }, + system_open = { + cmd = nil, + args = {} + }, + filters = { + dotfiles = false, + custom = {} + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + height = 30, + hide_root_folder = false, + side = 'left', + auto_resize = false, + mappings = { + custom_only = false, + list = {} + }, + number = false, + relativenumber = false, + signcolumn = "yes" + }, + trash = { + cmd = "trash", + require_confirm = true + } +} +EOF diff --git a/.config/nvim/after/plugin/telescope.rc.vim b/.config/nvim/after/plugin/telescope.rc.vim new file mode 100644 index 0000000..fa1154f --- /dev/null +++ b/.config/nvim/after/plugin/telescope.rc.vim @@ -0,0 +1,33 @@ +" Find files using Telescope command-line sugar. +"nnoremap f Telescope find_files +"nnoremap g Telescope live_grep +"nnoremap b Telescope buffers +"nnoremap fh Telescope help_tags + +lua << EOF + +require('telescope').load_extension('ultisnips') + +EOF + +" Using Lua functions +nnoremap f lua require('telescope.builtin').find_files() +nnoremap a lua require('telescope.builtin').live_grep() +nnoremap b lua require('telescope.builtin').buffers() +nnoremap r lua require('telescope.builtin').resume() +"nnoremap fh lua require('telescope.builtin').help_tags() +nnoremap tc lua require('telescope.builtin').commands() +nnoremap t: lua require('telescope.builtin').command_history() +nnoremap t/ lua require('telescope.builtin').search_history() +nnoremap tr lua require('telescope.builtin').registers() + +" Neovim lsp pickers +nnoremap tr lua require('telescope.builtin').lsp_references() +nnoremap td lua require('telescope.builtin').lsp_definitions() + +" git pickers +nnoremap gc lua require('telescope.builtin').git_commits() +nnoremap gC lua require('telescope.builtin').git_bcommits() +nnoremap gb lua require('telescope.builtin').git_branches() + +nnoremap s lua require('telescope').extensions.ultisnips.ultisnips() diff --git a/.config/nvim/after/plugin/ultisnips.rc.vim b/.config/nvim/after/plugin/ultisnips.rc.vim index ef76fac..80a9672 100644 --- a/.config/nvim/after/plugin/ultisnips.rc.vim +++ b/.config/nvim/after/plugin/ultisnips.rc.vim @@ -4,5 +4,5 @@ let g:completion_enable_snippet = 'UltiSnips' iunmap "map =UltiSnips#ExpandSnippet() "let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" +let g:UltiSnipsJumpForwardTrigger="n" +let g:UltiSnipsJumpBackwardTrigger="p" diff --git a/.config/nvim/after/plugin/vim-test.rc.vim b/.config/nvim/after/plugin/vim-test.rc.vim index 905ddac..21f5c47 100644 --- a/.config/nvim/after/plugin/vim-test.rc.vim +++ b/.config/nvim/after/plugin/vim-test.rc.vim @@ -1,7 +1,7 @@ -nmap tn :TestNearest -nmap tf :TestFile -nmap ts :TestSuite -nmap tl :TestLast -nmap tv :TestVisit - -let test#strategy = "floaterm" +"nmap tn :TestNearest +"nmap tf :TestFile +"nmap ts :TestSuite +"nmap tl :TestLast +"nmap tv :TestVisit +" +"let test#strategy = "floaterm" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 4fc2f99..1180e84 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -13,7 +13,7 @@ call plug#begin('~/.config/nvim/plugins') " Code development helpers {{{ Plug 'neovim/nvim-lspconfig' -Plug 'ray-x/lsp_signature.nvim' +"Plug 'ray-x/lsp_signature.nvim' Plug 'RRethy/vim-illuminate' " main one @@ -50,13 +50,14 @@ Plug 'quangnguyen30192/cmp-nvim-ultisnips' " }}} " Files switch, jump and grep-like tools {{{ +Plug 'kyazdani42/nvim-web-devicons' " for file icons +Plug 'kyazdani42/nvim-tree.lua' Plug 'derekwyatt/vim-fswitch' -Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } -Plug 'junegunn/fzf' | Plug 'junegunn/fzf.vim' +"Plug 'junegunn/fzf' | Plug 'junegunn/fzf.vim' Plug 'nvim-lua/popup.nvim' Plug 'nvim-lua/plenary.nvim' -"Plug 'nvim-telescope/telescope.nvim' -"Plug 'fhill2/telescope-ultisnips.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'fhill2/telescope-ultisnips.nvim' Plug 'inside/vim-search-pulse' Plug 'wellle/targets.vim' "Plug 'voldikss/vim-floaterm'