From 8c30d6f1d6f87860ef576ed69240b4a660c97efb Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Fri, 29 Apr 2022 17:09:49 -0700 Subject: [PATCH] update --- mpd-notification/mpd-notification.conf | 2 +- nvim/init.vim | 4 +- nvim/keybindings.vim | 13 +- nvim/plugin-confs/lsp-signature.lua | 78 +++++----- nvim/plugin-confs/lspconfig.lua | 13 +- nvim/plugin-confs/nvim-cmp.lua | 2 +- nvim/plugin-confs/nvimtree.lua | 192 ++++++++++++------------- nvim/plugin-confs/treesitter.lua | 46 +++--- vim/keybindings.vim | 1 - vim/plugin-confs/fzf.vim | 4 +- 10 files changed, 193 insertions(+), 162 deletions(-) diff --git a/mpd-notification/mpd-notification.conf b/mpd-notification/mpd-notification.conf index 9482a60..282529b 100644 --- a/mpd-notification/mpd-notification.conf +++ b/mpd-notification/mpd-notification.conf @@ -1,6 +1,6 @@ host = localhost port = 6600 -music-dir = /home/sudacode/Music/ +music-dir = /jellyfin/music oneline = false scale = 600 timeout = 5 diff --git a/nvim/init.vim b/nvim/init.vim index 5177925..073d2e0 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -38,12 +38,14 @@ set expandtab set hidden set nobackup set nowritebackup -set cmdheight=2 +set cmdheight=1 set updatetime=300 set timeoutlen=400 " Don't pass messages to |ins-completion-menu|. set shortmess+=c +set pumwidth=35 + " Install vim-plug if not found if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs diff --git a/nvim/keybindings.vim b/nvim/keybindings.vim index 8958aac..f9b58ba 100644 --- a/nvim/keybindings.vim +++ b/nvim/keybindings.vim @@ -6,13 +6,16 @@ vnoremap < >gv " for toggling/hiding the split-term -tnoremap :FloatermToggle floatingterm +tnoremap :FloatermToggle floatterm tnoremap tnoremap tt :FloatermToggle split-term +tnoremap tf :FloatermToggle floatterm +tnoremap tp :FloatermToggle ipython +tnoremap tP :FloatermToggle ipython-full nmap :bnext nmap :bprev -nmap :wa:FloatermToggle floatingterm +nmap :wa:FloatermToggle floatterm nmap :NvimTreeToggle " open file under cursor, create if necessary @@ -91,8 +94,11 @@ nmap n :NvimTreeToggle nmap ob :FloatermNew --title=bpytop --opener=vsplit bpytop nmap od :FloatermNew --title=lazydocker --opener=vsplit lazydocker +nmap of :wa:FloatermToggle floatterm nmap oh :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=split --position=botright --height=0.45 nmap on :FloatermNew --title=ncmpcpp --opener=vsplit ncmpcpp +nmap op :FloatermNew --title=ipython --name=ipython --opener=split --wintype=vsplit --position=botright --width=0.5 ipython +nmap oP :FloatermNew --title=ipython-full --name=ipython-full --opener=edit --width=1.0 --height=1.0 ipython nmap or :FloatermNew --title=ranger --opener=vsplit ranger --cmd="cd $PWD" nmap ot :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=vsplit --position=botright --width=0.5 @@ -107,7 +113,10 @@ nmap sh :History: nmap s/ :History/ nnoremap tc :DashboardChangeColorscheme +nmap tf :wa:FloatermToggle floatterm nmap to :SymbolsOutline +nmap tp :FloatermToggle ipython +nmap tP :FloatermToggle ipython-full nmap tt :FloatermToggle split-term nmap wa :lua vim.lsp.buf.add_workspace_folder() diff --git a/nvim/plugin-confs/lsp-signature.lua b/nvim/plugin-confs/lsp-signature.lua index c793f62..afb7bb4 100644 --- a/nvim/plugin-confs/lsp-signature.lua +++ b/nvim/plugin-confs/lsp-signature.lua @@ -1,55 +1,55 @@ - cfg = { - debug = false, -- set to true to enable debug logging - log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on - -- default is ~/.cache/nvim/lsp_signature.log - verbose = false, -- show debug line number +cfg = { + debug = false, -- set to true to enable debug logging + log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on + -- default is ~/.cache/nvim/lsp_signature.log + verbose = false, -- show debug line number - bind = true, -- This is mandatory, otherwise border config won't get registered. - -- If you want to hook lspsaga or other signature handler, pls set to false - doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); - -- set to 0 if you DO NOT want any API comments be shown - -- This setting only take effect in insert mode, it does not affect signature help in normal - -- mode, 10 by default + bind = true, -- This is mandatory, otherwise border config won't get registered. + -- If you want to hook lspsaga or other signature handler, pls set to false + doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); + -- set to 0 if you DO NOT want any API comments be shown + -- This setting only take effect in insert mode, it does not affect signature help in normal + -- mode, 10 by default - floating_window = true, -- show hint in a floating window, set to false for virtual text only mode + floating_window = true, -- show hint in a floating window, set to false for virtual text only mode - floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: - -- will set to true when fully tested, set to false will use whichever side has more space - -- this setting will be helpful if you do not want the PUM and floating win overlap + floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: + -- will set to true when fully tested, set to false will use whichever side has more space + -- this setting will be helpful if you do not want the PUM and floating win overlap - floating_window_off_x = 1, -- adjust float windows x position. - floating_window_off_y = 1, -- adjust float windows y position. + floating_window_off_x = 1, -- adjust float windows x position. + floating_window_off_y = 1, -- adjust float windows y position. - fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters - hint_enable = true, -- virtual hint enable - hint_prefix = " ", -- Panda for parameter - hint_scheme = "String", - hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight - max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down - -- to view the hiding contents - max_width = 80, -- max_width of signature floating_window, line will be wrapped if exceed max_width - handler_opts = { - border = "rounded" -- double, rounded, single, shadow, none - }, + fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters + hint_enable = true, -- virtual hint enable + hint_prefix = " ", -- Panda for parameter + hint_scheme = "String", + hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight + max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down + -- to view the hiding contents + max_width = 40, -- max_width of signature floating_window, line will be wrapped if exceed max_width + handler_opts = { + border = "rounded" -- double, rounded, single, shadow, none + }, - always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 + always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 - auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. - extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} - zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom + auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. + extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} + zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom - padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc + padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc - transparency = nil, -- disabled by default, allow floating win transparent value 1~100 - shadow_blend = 36, -- if you using shadow as border use this set the opacity - shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' - timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency - toggle_key = nil -- toggle signature on and off in insert mode, e.g. toggle_key = '' + transparency = nil, -- disabled by default, allow floating win transparent value 1~100 + shadow_blend = 36, -- if you using shadow as border use this set the opacity + shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' + timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency + toggle_key = nil -- toggle signature on and off in insert mode, e.g. toggle_key = '' } -- recommended: -require'lsp_signature'.setup(cfg) -- no need to specify bufnr if you don't use toggle_key +require 'lsp_signature'.setup(cfg) -- no need to specify bufnr if you don't use toggle_key -- You can also do this inside lsp on_attach -- note: on_attach deprecated diff --git a/nvim/plugin-confs/lspconfig.lua b/nvim/plugin-confs/lspconfig.lua index f73b811..14aaff8 100644 --- a/nvim/plugin-confs/lspconfig.lua +++ b/nvim/plugin-confs/lspconfig.lua @@ -70,11 +70,21 @@ local border = { { "│", "FloatBorder" }, } + local handlers = { ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }), ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }), } +-- local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview +-- function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) +-- opts = { +-- { "border", border }, +-- } +-- opts.border = opts.border or border +-- return orig_util_open_floating_preview(contents, syntax, opts, ...) +-- end + local DEFAULT_SETTINGS = { ui = { icons = { @@ -176,7 +186,8 @@ end) -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches -local servers = { 'pyright', 'bashls', 'vimls', 'yamlls', 'dockerls', 'html', 'sumneko_lua', 'dotls', 'rust_analyzer', 'clangd', 'ansiblels' } +-- local servers = { 'pyright', 'bashls', 'vimls', 'yamlls', 'dockerls', 'html', 'sumneko_lua', 'dotls', 'rust_analyzer', 'clangd', 'ansiblels' } +local servers = { 'jedi_language_server', 'bashls', 'vimls', 'yamlls', 'dockerls', 'html', 'sumneko_lua', 'dotls', 'rust_analyzer', 'clangd', 'ansiblels' } for _, lsp in pairs(servers) do require('lspconfig')[lsp].setup { on_attach = on_attach, diff --git a/nvim/plugin-confs/nvim-cmp.lua b/nvim/plugin-confs/nvim-cmp.lua index aedb035..00b244b 100644 --- a/nvim/plugin-confs/nvim-cmp.lua +++ b/nvim/plugin-confs/nvim-cmp.lua @@ -62,7 +62,7 @@ cmp.setup({ formatting = { format = lspkind.cmp_format({ mode = 'symbol', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + maxwidth = 20, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- The function below will be called before any actual modifications from lspkind -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) diff --git a/nvim/plugin-confs/nvimtree.lua b/nvim/plugin-confs/nvimtree.lua index afd5b8e..c218e5c 100644 --- a/nvim/plugin-confs/nvimtree.lua +++ b/nvim/plugin-confs/nvimtree.lua @@ -1,106 +1,106 @@ -require'nvim-tree'.setup { - disable_netrw = false, - hijack_netrw = false, - 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 = true, - 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 = 35, - height = 35, - hide_root_folder = false, - side = 'left', - auto_resize = false, - mappings = { - custom_only = false, - list = {} +require 'nvim-tree'.setup { + disable_netrw = false, + hijack_netrw = false, + 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 = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + } }, - number = false, - relativenumber = false, - signcolumn = "yes" - }, - trash = { - cmd = "trash", - require_confirm = true - }, - actions = { - change_dir = { - global = false, + update_focused_file = { + enable = false, + update_cwd = false, + ignore_list = {} }, - open_file = { - quit_on_open = false, + system_open = { + cmd = nil, + args = {} + }, + filters = { + dotfiles = false, + custom = {} + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 35, + height = 35, + 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 + }, + actions = { + change_dir = { + global = false, + }, + open_file = { + quit_on_open = false, + } } - } } -- local tree_cb = require'nvim-tree.config'.nvim_tree_callback -- default mappings local list = { - { key = {"", "o", "<2-LeftMouse>"}, action = "edit" }, - { key = {"O"}, action = "edit_no_picker" }, - { key = {"<2-RightMouse>", ""}, action = "cd" }, - { key = "", action = "vsplit" }, - { key = "", action = "split" }, - { key = "", action = "tabnew" }, - { key = "<", action = "prev_sibling" }, - { key = ">", action = "next_sibling" }, - { key = "P", action = "parent_node" }, - { key = "", action = "close_node" }, - { key = "", action = "preview" }, - { key = "K", action = "first_sibling" }, - { key = "J", action = "last_sibling" }, - { key = "I", action = "toggle_ignored" }, - { key = "H", action = "toggle_dotfiles" }, - { key = "R", action = "refresh" }, - { key = "a", action = "create" }, - { key = "d", action = "remove" }, - { key = "D", action = "trash" }, - { key = "r", action = "rename" }, - { key = "", action = "full_rename" }, - { key = "x", action = "cut" }, - { key = "c", action = "copy" }, - { key = "p", action = "paste" }, - { key = "y", action = "copy_name" }, - { key = "Y", action = "copy_path" }, - { key = "gy", action = "copy_absolute_path" }, - { key = "[c", action = "prev_git_item" }, - { key = "]c", action = "next_git_item" }, - { key = "-", action = "dir_up" }, - { key = "s", action = "system_open" }, - { key = "q", action = "close" }, - { key = "g?", action = "toggle_help" }, + { key = { "", "o", "<2-LeftMouse>" }, action = "edit" }, + { key = { "O" }, action = "edit_no_picker" }, + { key = { "<2-RightMouse>", "" }, action = "cd" }, + { key = "", action = "vsplit" }, + { key = "", action = "split" }, + { key = "", action = "tabnew" }, + { key = "<", action = "prev_sibling" }, + { key = ">", action = "next_sibling" }, + { key = "P", action = "parent_node" }, + { key = "", action = "close_node" }, + { key = "", action = "preview" }, + { key = "K", action = "first_sibling" }, + { key = "J", action = "last_sibling" }, + { key = "I", action = "toggle_ignored" }, + { key = "H", action = "toggle_dotfiles" }, + { key = "R", action = "refresh" }, + { key = "a", action = "create" }, + { key = "d", action = "remove" }, + { key = "D", action = "trash" }, + { key = "r", action = "rename" }, + { key = "", action = "full_rename" }, + { key = "x", action = "cut" }, + { key = "c", action = "copy" }, + { key = "p", action = "paste" }, + { key = "y", action = "copy_name" }, + { key = "Y", action = "copy_path" }, + { key = "gy", action = "copy_absolute_path" }, + { key = "[c", action = "prev_git_item" }, + { key = "]c", action = "next_git_item" }, + { key = "-", action = "dir_up" }, + { key = "s", action = "system_open" }, + { key = "q", action = "close" }, + { key = "g?", action = "toggle_help" }, } diff --git a/nvim/plugin-confs/treesitter.lua b/nvim/plugin-confs/treesitter.lua index c68e5ea..5d4778a 100644 --- a/nvim/plugin-confs/treesitter.lua +++ b/nvim/plugin-confs/treesitter.lua @@ -1,24 +1,34 @@ -require'nvim-treesitter.configs'.setup { - -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = "maintained", +require 'nvim-treesitter.configs'.setup { + -- One of "all", "maintained" (parsers with maintainers), or a list of languages + -- ensure_installed = "maintained", - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, - -- List of parsers to ignore installing - -- ignore_install = { "javascript" }, + -- List of parsers to ignore installing + -- ignore_install = { "javascript" }, - highlight = { - -- `false` will disable the whole extension - enable = true, + highlight = { + -- `false` will disable the whole extension + enable = true, - -- list of language that will be disabled - -- disable = { "c", "rust" }, + -- list of language that will be disabled + -- disable = { "c", "rust" }, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, } diff --git a/vim/keybindings.vim b/vim/keybindings.vim index 605688b..2ed9d18 100644 --- a/vim/keybindings.vim +++ b/vim/keybindings.vim @@ -51,7 +51,6 @@ nmap n :NvimTreeToggle nmap ob :FloatermNew --title=bpytop --opener=vsplit bpytop nmap od :FloatermNew --title=lazydocker --opener=vsplit lazydocker nmap on :FloatermNew --title=ncmpcpp --opener=vsplit ncmpcpp -nmap oo :OverCommandLine nmap or :FloatermNew --title=ranger --opener=vsplit ranger --cmd="cd $PWD" " nmap ot :vertical botright ter ++kill=terminal ++close nmap ot :FloatermNew --title=floaterm --name=vsplit-term --wintype=vsplit --position=botright --width=0.5 diff --git a/vim/plugin-confs/fzf.vim b/vim/plugin-confs/fzf.vim index f43f106..f4ebfb8 100644 --- a/vim/plugin-confs/fzf.vim +++ b/vim/plugin-confs/fzf.vim @@ -11,8 +11,8 @@ let g:fzf_tags_command = 'ctags -R' " - CTRL-/ will toggle preview window. " - Note that this array is passed as arguments to fzf#vim#with_preview function. " - To learn more about preview window options, see `--preview-window` section of `man fzf`. -let g:fzf_preview_window = ['right:50%', 'ctrl-/'] -let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.75 } } +let g:fzf_preview_window = ['right:45%', 'ctrl-/'] +let g:fzf_layout = { 'window': { 'width': 0.95, 'height': 0.85 } } let g:fzf_action = { \ 'ctrl-t': 'tab split',