diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-05-31 22:20:30 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-05-31 22:20:30 +0200 |
commit | 7d1e8075b8f156f3f8c300326abf730a1a8f2875 (patch) | |
tree | 4fff845d6cd1b66e267ef76dfad122a174f2c7a4 | |
parent | 0ce9de258802b9c3259083e6f1ab5739e8e51084 (diff) |
Copying of Luke's dots
32 files changed, 537 insertions, 286 deletions
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index d8570de..6804615 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -5,7 +5,7 @@ colors: # Default colors primary: - background: '#232731' + background: '#080808' foreground: '#d8d8d8' # Colors the cursor will use if `custom_cursor_colors` is true @@ -70,7 +70,7 @@ env: window: padding: x: 16 - y: 10 + y: 16 # scrolling: # # Maximum number of lines in the scrollback buffer. # # Specifying '0' will disable scrolling. diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..92567e6 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,107 @@ +# Luke's lf settings + +# Basic vars +set shell bash +set shellopts '-eu' +set ifs "\n" +set scrolloff 10 +set icons +set period 1 +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" + +# Vars that depend on environmental variables +$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope" + +# cmds/functions +cmd open ${{ + case $(file --mime-type $f -b) in + image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;; + text/*) $EDITOR $fx;; + image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;; + audio/*) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" + +cmd extract ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "extract?[y/N]" + read ans + [ $ans = "y" ] && ext $fx +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +cmd moveto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Move to where?" + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|' )" && + for x in $fx; do + eval mv -iv \"$x\" \"$dest\" + done && + notify-send "đ File(s) moved." "File(s) moved to $dest." +}} + +cmd copyto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Copy to where?" + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|' )" && + for x in $fx; do + eval cp -ivr \"$x\" \"$dest\" + done && + notify-send "đ File(s) copied." "File(s) copies to $dest." +}} + +cmd setbg "$1" +cmd bulkrename $vidir + +# Bindings +map <c-f> $lf -remote "send $id select '$(fzf)'" +map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" +map gh +map g top +map D delete +map E extract +map C copyto +map M moveto +map <c-n> push :mkdir<space> +map <c-r> reload +map <c-s> set hidden! +map <enter> shell +map x $$f +map X !$f +map o &mimeopen $f +map O $mimeopen --ask $f + +map A rename # at the very end +map c push A<c-u> # new rename +map I push A<c-a> # at the very beginning +map i push A<a-b><a-b><a-f> # before extention +map a push A<a-b> # after extention +map B bulkrename +map b $setbg $f + +map <c-e> down +map <c-y> up +map V push :!nvim<space> + +# Source Bookmarks +source "~/.config/lf/shortcutrc" diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100644 index 0000000..45f9f33 --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,58 @@ +#!/bin/bash + +set -C -f -u +#IFS=$'\n' +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +# ANSI color codes are supported. +# STDIN is disabled, so interactive scripts won't work properly + +# This script is considered a configuration file and must be updated manually. + +# Meanings of exit codes: +# code | meaning | action of ranger +# -----+------------+------------------------------------------- +# 0 | success | Display stdout as preview +# 1 | no preview | Display no preview at all +# 2 | plain text | Display the plain content of the file + +# Script arguments +FILE_PATH="${1}" # Full path of the highlighted file +HEIGHT="${2}" + +#FILE_EXTENSION="${FILE_PATH##*.}" +#FILE_EXTENSION_LOWER=$(echo ${FILE_EXTENSION} | tr '[:upper:]' '[:lower:]') + +# Settings +HIGHLIGHT_SIZE_MAX=262143 # 256KiB +HIGHLIGHT_TABWIDTH=8 +HIGHLIGHT_STYLE='pablo' + + +handle_mime() { + local mimetype="${1}" + case "${mimetype}" in + text/html) w3m -dump "${FILE_PATH}" ;; + text/troff) man ./ "${FILE_PATH}" | col -b ;; + text/* | */xml) + if [ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then + exit 2 + fi + if [ "$( tput colors )" -ge 256 ]; then + local highlight_format='xterm256' + else + local highlight_format='ansi' + fi + highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \ + --style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" ;; + application/zip) atool --list -- "${FILE_PATH}" ;; + image/*) chafa --fill=block --symbols=block -c 256 -s 80x"${HEIGHT}" "${FILE_PATH}" || exit 1;; + video/* | audio/*|application/octet-stream) mediainfo "${FILE_PATH}" || exit 1;; + */pdf) pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - ;; + *opendocument*) odt2txt "${FILE_PATH}" ;; + esac +} + +MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )" +handle_mime "${MIMETYPE}" +exit 1 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 43a3b12..b2f692a 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,26 +1,39 @@ -require('plugins') require('globals') -require('_utils') -vim.cmd('luafile ~/.config/nvim/language-settings.lua') -require('_autocommands') +require('plugins') +vim.cmd('luafile '..CONFIG_PATH..'/language-settings.lua') require('settings') +require('_utils') require('mappings') + +require('_autopairs') +require('_autocommands') + +require('_gitblame') +require('_gitsigns') + +require('_nvimtree') require('colorscheme') + require('_galaxyline') + +require('_hop') + require('_comment') +require('_colorizer') require('_compe') + require('_barbar') + require('_dashboard') + require('_telescope') -require('_gitsigns') -require('_nvimtree') require('_treesitter') -require('_autopairs') + require('_rnvimr') -require('_vim-rooter') require('_quickscope') -require('_neogit') require('_which-key') + +require('_lsp-rooter') require('_true-zen') vim.cmd('source ~/.config/nvim/vim-script/functions.vim') @@ -30,6 +43,7 @@ require('lsp') require('lsp.clangd') require('lsp.lua-ls') require('lsp.bash-ls') +require('lsp.go-ls') require('lsp.python-ls') require('lsp.rust-ls') require('lsp.json-ls') diff --git a/.config/nvim/language-settings.lua b/.config/nvim/language-settings.lua index 54e98b2..c768737 100644 --- a/.config/nvim/language-settings.lua +++ b/.config/nvim/language-settings.lua @@ -17,6 +17,9 @@ O.python.diagnostics.virtual_text = true O.python.diagnostics.signs = true O.python.diagnostics.underline = true +-- go +O.go.autoformat = true + -- lua O.lua.formatter = 'lua-format' O.lua.autoformat = false diff --git a/.config/nvim/lua/_autocommands/init.lua b/.config/nvim/lua/_autocommands/init.lua index 1642127..0b69c0f 100644 --- a/.config/nvim/lua/_autocommands/init.lua +++ b/.config/nvim/lua/_autocommands/init.lua @@ -22,16 +22,25 @@ if O.lua.autoformat then table.insert(auto_formatters, lua_format) end local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} if O.json.autoformat then table.insert(auto_formatters, json_format) end +local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} +if O.go.autoformat then table.insert(auto_formatters, go_format) end + utils.define_augroups({ _general_settings = { {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'VimLeavePre', '*', 'set title set titleold='} + {'VimLeavePre', '*', 'set title set titleold='}, + {'FileType', 'qf', 'set nobuflisted'}, - -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'}, - -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'}, + }, + _go = { + -- Go generally requires Tabs instead of spaces. + {'FileType', 'go', 'setlocal tabstop=4'}, + {'FileType', 'go', 'setlocal shiftwidth=4'}, + {'FileType', 'go', 'setlocal softtabstop=4'}, + {'FileType', 'go', 'setlocal noexpandtab'}, }, _dashboard = { -- seems to be nobuflisted that makes my stuff disapear will do more testing diff --git a/.config/nvim/lua/_autopairs/init.lua b/.config/nvim/lua/_autopairs/init.lua index 5d0adf8..d9caf22 100644 --- a/.config/nvim/lua/_autopairs/init.lua +++ b/.config/nvim/lua/_autopairs/init.lua @@ -1,77 +1,45 @@ -require('nvim-autopairs').setup() +local remap = vim.api.nvim_set_keymap local npairs = require('nvim-autopairs') +local Rule = require('nvim-autopairs.rule') -local function imap(lhs, rhs, opts) - local options = {noremap = false} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap('i', lhs, rhs, options) -end - -_G.MUtils = {} +-- skip it, if you use another global object +_G.MUtils= {} --- TEST vim.g.completion_confirm_key = "" -MUtils.completion_confirm = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info()["selected"] ~= -1 then - vim.fn["compe#confirm"]() - -- return npairs.esc("<c-y>") - return npairs.esc("") - else - vim.defer_fn(function() - vim.fn["compe#confirm"]("<cr>") - end, 20) - return npairs.esc("<c-n>") - end +MUtils.completion_confirm=function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + return vim.fn["compe#confirm"](npairs.esc("<cr>")) else - return npairs.check_break_line_char() + return npairs.esc("<cr>") end + else + return npairs.autopairs_cr() + end end --- TEST -MUtils.completion_confirm = function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info()["selected"] ~= -1 then - vim.fn["compe#confirm"]() - return npairs.esc("") - else - vim.api.nvim_select_popupmenu_item(0, false, false, {}) - vim.fn["compe#confirm"]() - return npairs.esc("<c-n>") - end - else - return npairs.check_break_line_char() - end -end -MUtils.tab = function() - if vim.fn.pumvisible() ~= 0 then - return npairs.esc("<C-n>") - else - if vim.fn["vsnip#available"](1) ~= 0 then - vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83)) - return npairs.esc("") - else - return npairs.esc("<Tab>") - end - end -end +remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) -MUtils.s_tab = function() - if vim.fn.pumvisible() ~= 0 then - return npairs.esc("<C-p>") - else - if vim.fn["vsnip#jumpable"](-1) ~= 0 then - vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83)) - return npairs.esc("") - else - return npairs.esc("<C-h>") - end - end -end +npairs.setup({ + check_ts = true, + ts_config = { + lua = {'string'},-- it will not add pair on that treesitter node + javascript = {'template_string'}, + java = false,-- don't check treesitter on java + } +}) + +require('nvim-treesitter.configs').setup { + autopairs = {enable = true} +} + +local ts_conds = require('nvim-autopairs.ts-conds') --- Autocompletion and snippets -vim.api.nvim_set_keymap('i', '<CR>', 'v:lua.MUtils.completion_confirm()', {expr = true, noremap = true}) --- imap("<CR>", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true}) -imap("<Tab>", "v:lua.MUtils.tab()", {expr = true, noremap = true}) -imap("<S-Tab>", "v:lua.MUtils.s_tab()", {expr = true, noremap = true}) +-- press % => %% is only inside comment or string +npairs.add_rules({ + Rule("%", "%", "lua") + :with_pair(ts_conds.is_ts_node({'string','comment'})), + Rule("$", "$", "lua") + :with_pair(ts_conds.is_not_ts_node({'function'})) +}) diff --git a/.config/nvim/lua/_colorizer/init.lua b/.config/nvim/lua/_colorizer/init.lua index 1e25d7d..52e1f8f 100644 --- a/.config/nvim/lua/_colorizer/init.lua +++ b/.config/nvim/lua/_colorizer/init.lua @@ -2,12 +2,10 @@ require'colorizer'.setup( {'*';}, { RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - names = true; -- "Name" codes like Blue - RRGGBBAA = true; -- #RRGGBBAA hex codes - rgb_fn = true; -- CSS rgb() and rgba() functions - hsl_fn = true; -- CSS hsl() and hsla() functions - css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn + RRGGBB = true; -- #RRGGBB hex codes + RRGGBBAA = true; -- #RRGGBBAA hex codes + rgb_fn = true; -- CSS rgb() and rgba() functions + hsl_fn = true; -- CSS hsl() and hsla() functions + css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn }) - diff --git a/.config/nvim/lua/_compe/init.lua b/.config/nvim/lua/_compe/init.lua index 95c972d..10b3c54 100644 --- a/.config/nvim/lua/_compe/init.lua +++ b/.config/nvim/lua/_compe/init.lua @@ -20,19 +20,40 @@ require'compe'.setup { calc = {kind = " īŦ (Calc)"}, vsnip = {kind = " ī (Snippet)"}, nvim_lsp = {kind = " î (LSP)"}, - -- nvim_lua = {kind = " î
"}, nvim_lua = false, spell = {kind = " ī (Spell)"}, tags = false, vim_dadbod_completion = true, - -- snippets_nvim = {kind = " ī "}, - -- ultisnips = {kind = " ī "}, - -- treesitter = {kind = " īģ "}, emoji = {kind = " ī˛ (Emoji)", filetypes={"markdown", "text"}} - -- for emoji press : (idk if that in compe tho) } } +-- î +-- ī +-- īĒ +-- īą +-- ī +-- īļ +-- ī
+-- ī +-- īģ +-- īŧ +-- ī +-- ī +-- î +-- îŦ +-- īŋ +-- ī +-- īŦ +-- īĒ +-- ī
+-- ī ´ +-- m +-- ī +-- î +-- īŖ +-- īĩ + local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end diff --git a/.config/nvim/lua/_emmet/init.lua b/.config/nvim/lua/_emmet/init.lua deleted file mode 100644 index 9eafbf6..0000000 --- a/.config/nvim/lua/_emmet/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -vim.g.user_emmet_mode='inv' -vim.g.user_emmet_expandabbr_key = '<C-y>,' -vim.g.user_emmet_expandword_key = '<C-y>;' -vim.g.user_emmet_update_tag = '<C-y>u' -vim.g.user_emmet_balancetaginward_key = '<C-y>d' -vim.g.user_emmet_balancetagoutward_key = '<C-y>D' -vim.g.user_emmet_next_key = '<C-y>n' -vim.g.user_emmet_prev_key = '<C-y>N' -vim.g.user_emmet_imagesize_key = '<C-y>i' -vim.g.user_emmet_togglecomment_key = '<C-y>/' -vim.g.user_emmet_splitjointag_key = '<C-y>j' -vim.g.user_emmet_removetag_key = '<C-y>k' -vim.g.user_emmet_anchorizeurl_key = '<C-y>a' -vim.g.user_emmet_anchorizesummary_key = '<C-y>A' -vim.g.user_emmet_mergelines_key = '<C-y>m' -vim.g.user_emmet_codepretty_key = '<C-y>c' diff --git a/.config/nvim/lua/_galaxyline/init.lua b/.config/nvim/lua/_galaxyline/init.lua index 8673cde..7003575 100644 --- a/.config/nvim/lua/_galaxyline/init.lua +++ b/.config/nvim/lua/_galaxyline/init.lua @@ -1,6 +1,7 @@ local gl = require('galaxyline') +-- get my theme in galaxyline repo local colors = { - bg = '#232731', + bg = '#080808', yellow = '#DCDCAA', dark_yellow = '#D7BA7D', cyan = '#4EC9B0', @@ -22,7 +23,7 @@ local condition = require('galaxyline.condition') local gls = gl.section gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} -gls.left[1] = { +table.insert(gls.left, { ViMode = { provider = function() -- auto change color according the vim mode @@ -53,7 +54,8 @@ gls.left[1] = { end, highlight = {colors.red, colors.bg} } -} +}) + print(vim.fn.getbufvar(0, 'ts')) vim.fn.getbufvar(0, 'ts') diff --git a/.config/nvim/lua/_hop/init.lua b/.config/nvim/lua/_hop/init.lua new file mode 100644 index 0000000..acd4cd7 --- /dev/null +++ b/.config/nvim/lua/_hop/init.lua @@ -0,0 +1,2 @@ +vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true}) +vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true}) diff --git a/.config/nvim/lua/_lsp-rooter/init.lua b/.config/nvim/lua/_lsp-rooter/init.lua new file mode 100644 index 0000000..7f84907 --- /dev/null +++ b/.config/nvim/lua/_lsp-rooter/init.lua @@ -0,0 +1,5 @@ +require("lsp-rooter").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } diff --git a/.config/nvim/lua/_neogit/init.lua b/.config/nvim/lua/_neogit/init.lua deleted file mode 100644 index ca38081..0000000 --- a/.config/nvim/lua/_neogit/init.lua +++ /dev/null @@ -1 +0,0 @@ -local neogit = require('neogit') diff --git a/.config/nvim/lua/_numb/init.lua b/.config/nvim/lua/_numb/init.lua new file mode 100644 index 0000000..415327f --- /dev/null +++ b/.config/nvim/lua/_numb/init.lua @@ -0,0 +1,4 @@ +require('numb').setup{ + show_numbers = true, -- Enable 'number' for the window while peeking + show_cursorline = true -- Enable 'cursorline' for the window while peeking +} diff --git a/.config/nvim/lua/_nvimtree/init.lua b/.config/nvim/lua/_nvimtree/init.lua index 7dfa02f..64dff6c 100644 --- a/.config/nvim/lua/_nvimtree/init.lua +++ b/.config/nvim/lua/_nvimtree/init.lua @@ -1,4 +1,18 @@ --- vim.g.nvim_tree_disable_netrw = 0 -- "1 by default, disables netrw +--[[ " +--let g:nvim_tree_auto_ignore_ft = 'startify' "empty by default, don't auto open tree on specific filetypes. +let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.` +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_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open +" let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file +let g:nvim_tree_show_icons = { + \ 'git': 1, + \ 'folders': 1, + \ 'files': 1, + \ } +"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 ]] -- vim.g.nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default +-- vim.g.nvim_tree_disable_netrw = 0 -- moved to lv-globals -- vim.g.nvim_tree_hijack_netrw = 0 --"1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities) vim.g.nvim_tree_hide_dotfiles = 1 -- 0 by default, this option hides files and folders starting with a dot `.` vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open diff --git a/.config/nvim/lua/_quickscope/init.lua b/.config/nvim/lua/_quickscope/init.lua index 4c70669..817bc6d 100644 --- a/.config/nvim/lua/_quickscope/init.lua +++ b/.config/nvim/lua/_quickscope/init.lua @@ -1,7 +1,4 @@ -- Trigger a highlight in the appropriate direction when pressing these keys: -- vim.cmd('let g:qs_highlight_on_keys = [\'f\', \'F\', \'t\', \'T\']') vim.g.qs_highlight_on_keys = {'f', 'F', 't', 'T'} - -vim.api.nvim_exec('highlight QuickScopePrimary guifg=\'#00C7DF\' gui=underline ctermfg=155 cterm=underline', false) -vim.cmd('highlight QuickScopeSecondary guifg=\'#eF5F70\' gui=underline ctermfg=81 cterm=underline') vim.g.qs_max_chars=150 diff --git a/.config/nvim/lua/_telescope/init.lua b/.config/nvim/lua/_telescope/init.lua index 744fdbf..497f74d 100644 --- a/.config/nvim/lua/_telescope/init.lua +++ b/.config/nvim/lua/_telescope/init.lua @@ -1,4 +1,5 @@ local actions = require('telescope.actions') +local trouble = require("trouble.providers.telescope") -- Global remapping ------------------------------ -- '--color=never', @@ -36,12 +37,15 @@ require('telescope').setup { buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, mappings = { i = { + ["<C-c>"] = actions.close, ["<C-j>"] = actions.move_selection_next, ["<C-k>"] = actions.move_selection_previous, + ["<c-t>"] = trouble.open_with_trouble, + ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, -- To disable a keymap, put [map] = false -- So, to not map "<C-n>", just put -- ["<c-x>"] = false, - ["<esc>"] = actions.close, + -- ["<esc>"] = actions.close, -- Otherwise, just set the mapping to the function that you want it to be. -- ["<C-i>"] = actions.select_horizontal, @@ -54,23 +58,12 @@ require('telescope').setup { }, n = { ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous + ["<C-k>"] = actions.move_selection_previous, + ["<c-t>"] = trouble.open_with_trouble, + ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist -- ["<C-i>"] = my_cool_custom_action, } } }, - require'telescope'.setup { - extensions = { - media_files = { - -- filetypes whitelist - -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} - filetypes = {"png", "webp", "jpg", "jpeg"}, - find_cmd = "rg" -- find command (defaults to `fd`) - } - } - } + extensions = {fzy_native = {override_generic_sorter = false, override_file_sorter = true}} } -vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>lua require("telescope.builtin").find_files()<cr>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>lua require("telescope.builtin").live_grep()<cr>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>lua require("telescope.builtin").buffers()<cr>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>lua require("telescope.builtin").help_tags()<cr>', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/_treesitter/init.lua b/.config/nvim/lua/_treesitter/init.lua index b215e30..0cf6c56 100644 --- a/.config/nvim/lua/_treesitter/init.lua +++ b/.config/nvim/lua/_treesitter/init.lua @@ -1,9 +1,19 @@ require'nvim-treesitter.configs'.setup { ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages ignore_install = O.treesitter.ignore_install, + matchup = { + enable = true, -- mandatory, false will disable the whole extension + -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled + }, highlight = { enable = O.treesitter.highlight.enabled -- false will disable the whole extension }, + context_commentstring = { + enable = true, + config = { + css = '// %s' + } + }, -- indent = {enable = true, disable = {"python", "html", "javascript"}}, -- TODO seems to be broken indent = {enable = {"javascriptreact"}}, diff --git a/.config/nvim/lua/_true-zen/init.lua b/.config/nvim/lua/_true-zen/init.lua index 0705fbb..1cad678 100644 --- a/.config/nvim/lua/_true-zen/init.lua +++ b/.config/nvim/lua/_true-zen/init.lua @@ -1,9 +1,11 @@ -local true_zen = require("true-zen") - -- setup for TrueZen.nvim -true_zen.setup({ +require("true-zen").setup({ true_false_commands = false, cursor_by_mode = false, + before_minimalist_mode_shown = false, + before_minimalist_mode_hidden = false, + after_minimalist_mode_shown = false, + after_minimalist_mode_hidden = false, bottom = { hidden_laststatus = 0, hidden_ruler = false, @@ -33,35 +35,19 @@ true_zen.setup({ }, ataraxis = { just_do_it_for_me = false, - left_padding = 40, - right_padding = 40, - top_padding = 0, - bottom_padding = 0, - custome_bg = "", - disable_bg_configuration = false, - disable_fillchars_configuration = false, - force_when_plus_one_window = false, - force_hide_statusline = false - }, - focus = { - margin_of_error = 5, - focus_method = "experimental" - }, - events = { - before_minimalist_mode_shown = false, - before_minimalist_mode_hidden = false, - after_minimalist_mode_shown = false, - after_minimalist_mode_hidden = false + left_padding = 5, + right_padding = 5, + top_padding = 1, + bottom_padding = 1 }, integrations = { integration_galaxyline = true, integration_vim_airline = false, integration_vim_powerline = false, - integration_tmux = false, + integration_tmux = true, integration_express_line = false, integration_gitgutter = false, integration_vim_signify = false, - integration_limelight = false, - integration_tzfocus_tzataraxis = false + integration_limelight = false } }) diff --git a/.config/nvim/lua/_utils/init.lua b/.config/nvim/lua/_utils/init.lua index 4d5c890..9e15c02 100644 --- a/.config/nvim/lua/_utils/init.lua +++ b/.config/nvim/lua/_utils/init.lua @@ -1,6 +1,6 @@ -local nv_utils = {} +local lv_utils = {} -function nv_utils.define_augroups(definitions) -- {{{1 +function lv_utils.define_augroups(definitions) -- {{{1 -- Create autocommand groups based on the passed definitions -- -- The key will be the name of the group, and each definition @@ -24,159 +24,159 @@ end -- lsp -function nv_utils.add_to_workspace_folder() +function lv_utils.add_to_workspace_folder() vim.lsp.buf.add_workspace_folder() end -function nv_utils.clear_references() +function lv_utils.clear_references() vim.lsp.buf.clear_references() end -function nv_utils.code_action() +function lv_utils.code_action() vim.lsp.buf.code_action() end -function nv_utils.declaration() +function lv_utils.declaration() vim.lsp.buf.declaration() vim.lsp.buf.clear_references() end -function nv_utils.definition() +function lv_utils.definition() vim.lsp.buf.definition() vim.lsp.buf.clear_references() end -function nv_utils.document_highlight() +function lv_utils.document_highlight() vim.lsp.buf.document_highlight() end -function nv_utils.document_symbol() +function lv_utils.document_symbol() vim.lsp.buf.document_symbol() end -function nv_utils.formatting() +function lv_utils.formatting() vim.lsp.buf.formatting() end -function nv_utils.formatting_sync() +function lv_utils.formatting_sync() vim.lsp.buf.formatting_sync() end -function nv_utils.hover() +function lv_utils.hover() vim.lsp.buf.hover() end -function nv_utils.implementation() +function lv_utils.implementation() vim.lsp.buf.implementation() end -function nv_utils.incoming_calls() +function lv_utils.incoming_calls() vim.lsp.buf.incoming_calls() end -function nv_utils.list_workspace_folders() +function lv_utils.list_workspace_folders() vim.lsp.buf.list_workspace_folders() end -function nv_utils.outgoing_calls() +function lv_utils.outgoing_calls() vim.lsp.buf.outgoing_calls() end -function nv_utils.range_code_action() +function lv_utils.range_code_action() vim.lsp.buf.range_code_action() end -function nv_utils.range_formatting() +function lv_utils.range_formatting() vim.lsp.buf.range_formatting() end -function nv_utils.references() +function lv_utils.references() vim.lsp.buf.references() vim.lsp.buf.clear_references() end -function nv_utils.remove_workspace_folder() +function lv_utils.remove_workspace_folder() vim.lsp.buf.remove_workspace_folder() end -function nv_utils.rename() +function lv_utils.rename() vim.lsp.buf.rename() end -function nv_utils.signature_help() +function lv_utils.signature_help() vim.lsp.buf.signature_help() end -function nv_utils.type_definition() +function lv_utils.type_definition() vim.lsp.buf.type_definition() end -function nv_utils.workspace_symbol() +function lv_utils.workspace_symbol() vim.lsp.buf.workspace_symbol() end -- diagnostic -function nv_utils.get_all() +function lv_utils.get_all() vim.lsp.diagnostic.get_all() end -function nv_utils.get_next() +function lv_utils.get_next() vim.lsp.diagnostic.get_next() end -function nv_utils.get_prev() +function lv_utils.get_prev() vim.lsp.diagnostic.get_prev() end -function nv_utils.goto_next() +function lv_utils.goto_next() vim.lsp.diagnostic.goto_next() end -function nv_utils.goto_prev() +function lv_utils.goto_prev() vim.lsp.diagnostic.goto_prev() end -function nv_utils.show_line_diagnostics() +function lv_utils.show_line_diagnostics() vim.lsp.diagnostic.show_line_diagnostics() end -- git signs -function nv_utils.next_hunk() +function lv_utils.next_hunk() require('gitsigns').next_hunk() end -function nv_utils.prev_hunk() +function lv_utils.prev_hunk() require('gitsigns').prev_hunk() end -function nv_utils.stage_hunk() +function lv_utils.stage_hunk() require('gitsigns').stage_hunk() end -function nv_utils.undo_stage_hunk() +function lv_utils.undo_stage_hunk() require('gitsigns').undo_stage_hunk() end -function nv_utils.reset_hunk() +function lv_utils.reset_hunk() require('gitsigns').reset_hunk() end -function nv_utils.reset_buffer() +function lv_utils.reset_buffer() require('gitsigns').reset_buffer() end -function nv_utils.preview_hunk() +function lv_utils.preview_hunk() require('gitsigns').preview_hunk() end -function nv_utils.blame_line() +function lv_utils.blame_line() require('gitsigns').blame_line() end -- misc -function nv_utils.file_exists(name) +function lv_utils.file_exists(name) local f = io.open(name, "r") if f ~= nil then io.close(f) @@ -186,4 +186,4 @@ function nv_utils.file_exists(name) end end -return nv_utils +return lv_utils diff --git a/.config/nvim/lua/_which-key/init.lua b/.config/nvim/lua/_which-key/init.lua index 1770356..8c300c3 100644 --- a/.config/nvim/lua/_which-key/init.lua +++ b/.config/nvim/lua/_which-key/init.lua @@ -5,9 +5,9 @@ require("which-key").setup { -- the presets plugin, adds help for a bunch of default keybindings in Neovim -- No actual key bindings are created presets = { - operators = true, -- adds help for operators like d, y, ... - motions = true, -- adds help for motions - text_objects = true, -- help for text objects triggered after entering an operator + operators = false, -- adds help for operators like d, y, ... + motions = false, -- adds help for motions + text_objects = false, -- help for text objects triggered after entering an operator windows = true, -- default bindings on <c-w> nav = true, -- misc bindings to work with windows z = true, -- bindings for folds, spelling and others prefixed with z @@ -48,7 +48,7 @@ vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true} vim.g.mapleader = ' ' -- no hl -vim.api.nvim_set_keymap('n', '<Leader>n', ':set hlsearch!<CR>', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('n', '<Leader>h', ':set hlsearch!<CR>', {noremap = true, silent = true}) -- explorer vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true}) @@ -63,9 +63,6 @@ vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', {noremap = true, sil vim.api.nvim_set_keymap("n", "<leader>k", ":CommentToggle<CR>", {noremap = true, silent = true}) vim.api.nvim_set_keymap("v", "<leader>k", ":CommentToggle<CR>", {noremap = true, silent = true}) --- Zen mode -vim.api.nvim_set_keymap("n", "<leader>z", ':TZAtaraxis<CR>', {noremap = true, silent = true}) - -- close buffer vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", {noremap = true, silent = true}) @@ -73,18 +70,30 @@ vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", {noremap = true, s vim.api.nvim_set_keymap("n", "<leader>v", ":vsplit<CR>", {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "<leader>h", ":split<CR>", {noremap = true, silent = true}) +-- open projects +vim.api.nvim_set_keymap('n', '<leader>p', ":lua require'telescope'.extensions.project.project{}<CR>", + {noremap = true, silent = true}) -- TODO create entire treesitter section local mappings = { ["k"] = "Comment", ["c"] = "Close Buffer", - ["z"] = "Zen Mode", ["e"] = "Explorer", ["f"] = "Find File", + ["p"] = "Projects", ["n"] = "No Highlight", ["v"] = "Vertical Split", ["h"] = "Horizontal Split", d = { + name = "+Diagnostics", + t = {"<cmd>TroubleToggle<cr>", "trouble"}, + w = {"<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace"}, + d = {"<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document"}, + q = {"<cmd>TroubleToggle quickfix<cr>", "quickfix"}, + l = {"<cmd>TroubleToggle loclist<cr>", "loclist"}, + r = {"<cmd>TroubleToggle lsp_references<cr>", "references"}, + }, + D = { name = "+Debug", b = {"<cmd>DebugToggleBreakpoint<cr>", "Toggle Breakpoint"}, c = {"<cmd>DebugContinue<cr>", "Continue"}, @@ -125,10 +134,9 @@ local mappings = { s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"}, S = {"<cmd>Telescope lsp_workspace_symbols<cr>", "Workspace Symbols"} }, - s = { name = "+Search", - b = {"<cmd>Telescope git_branches<cr>", "File"}, + b = {"<cmd>Telescope git_branches<cr>", "Checkout branch"}, c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"}, d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, @@ -139,7 +147,15 @@ local mappings = { R = {"<cmd>Telescope registers<cr>", "Registers"}, t = {"<cmd>Telescope live_grep<cr>", "Text"} }, - S = {name = "+Session", s = {"<cmd>SessionSave<cr>", "Save Session"}, l = {"<cmd>SessionLoad<cr>", "Load Session"}} + S = {name = "+Session", s = {"<cmd>SessionSave<cr>", "Save Session"}, l = {"<cmd>SessionLoad<cr>", "Load Session"}}, + + -- extras + z = { + name = "+Zen", + s = {"<cmd>TZBottom<cr>", "toggle status line"}, + t = {"<cmd>TZTop<cr>", "toggle tab bar"}, + z = {"<cmd>TZAtaraxis<cr>", "toggle zen"}, + } } local wk = require("which-key") diff --git a/.config/nvim/lua/globals.lua b/.config/nvim/lua/globals.lua index a0f291c..9115c2e 100644 --- a/.config/nvim/lua/globals.lua +++ b/.config/nvim/lua/globals.lua @@ -1,3 +1,6 @@ +CONFIG_PATH = vim.fn.stdpath('config') +DATA_PATH = vim.fn.stdpath('data') +CACHE_PATH = vim.fn.stdpath('cache') O = { auto_close_tree = 0, auto_complete = true, @@ -7,6 +10,9 @@ O = { number = true, relative_number = true, shell = 'bash', + timeoutlen = 100, + nvim_tree_disable_netrw = 0, + extras = false, -- @usage pass a table with your desired languages treesitter = { @@ -18,18 +24,18 @@ O = { }, database = {save_location = '~/.config/nvim_db', auto_execute = 1}, python = { - linter = 'flake8', - formatter = 'black', + linter = '', + formatter = '', autoformat = false, isort = false, - diagnostics = {virtual_text = true, signs = true, underline = true} + diagnostics = {virtual_text = {spacing = 0, prefix = "ī"}, signs = true, underline = true}, + analysis = {type_checking = "basic", auto_search_paths = true, use_library_code_types = true} }, - dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'}, lua = { -- @usage can be 'lua-format' formatter = '', autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} + diagnostics = {virtual_text = {spacing = 0, prefix = "ī"}, signs = true, underline = true} }, sh = { -- @usage can be 'shellcheck' @@ -37,7 +43,7 @@ O = { -- @usage can be 'shfmt' formatter = '', autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} + diagnostics = {virtual_text = {spacing = 0, prefix = "ī"}, signs = true, underline = true} }, tsserver = { -- @usage can be 'eslint' @@ -45,7 +51,7 @@ O = { -- @usage can be 'prettier' formatter = '', autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} + diagnostics = {virtual_text = {spacing = 0, prefix = "ī"}, signs = true, underline = true} }, json = { -- @usage can be 'prettier' @@ -53,9 +59,6 @@ O = { autoformat = false, diagnostics = {virtual_text = true, signs = true, underline = true} }, - tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}}, - clang = {diagnostics = {virtual_text = true, signs = true, underline = true}}, + go = {}, + clang = {diagnostics = {virtual_text = {spacing = 0, prefix = "ī"}, signs = true, underline = true}}, } - -DATA_PATH = vim.fn.stdpath('data') -CACHE_PATH = vim.fn.stdpath('cache') diff --git a/.config/nvim/lua/lsp/efm-general-ls.lua b/.config/nvim/lua/lsp/efm-general-ls.lua index 16f3037..01bc3ee 100644 --- a/.config/nvim/lua/lsp/efm-general-ls.lua +++ b/.config/nvim/lua/lsp/efm-general-ls.lua @@ -92,7 +92,7 @@ require"lspconfig".efm.setup { -- init_options = {initializationOptions}, cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, init_options = {documentFormatting = true, codeAction = false}, - filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml", "markdown"}, + filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "json", "yaml", "markdown", "vue"}, settings = { rootMarkers = {".git/"}, languages = { @@ -101,6 +101,8 @@ require"lspconfig".efm.setup { sh = sh_arguments, javascript = tsserver_args, javascriptreact = tsserver_args, + typescript = tsserver_args, + typescriptreact = tsserver_args, html = {prettier}, css = {prettier}, json = {prettier}, diff --git a/.config/nvim/lua/lsp/go-ls.lua b/.config/nvim/lua/lsp/go-ls.lua new file mode 100644 index 0000000..1311247 --- /dev/null +++ b/.config/nvim/lua/lsp/go-ls.lua @@ -0,0 +1,7 @@ +require'lspconfig'.gopls.setup{ + cmd = {DATA_PATH .. "/lspinstall/go/gopls"}, + settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}}, + root_dir = require'lspconfig'.util.root_pattern(".git","go.mod","."), + init_options = {usePlaceholders = true, completeUnimported = true}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index b07858b..ef2e2f9 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -1,19 +1,19 @@ -- TODO figure out why this don't work vim.fn.sign_define( "LspDiagnosticsSignError", - {texthl = "LspDiagnosticsSignError", text = "ī", numhl = "LspDiagnosticsSignError"} + {texthl = "LspDiagnosticsSignError", text = "ī", numhl = "LspDiagnosticsSignError"} ) vim.fn.sign_define( "LspDiagnosticsSignWarning", - {texthl = "LspDiagnosticsSignWarning", text = "īą", numhl = "LspDiagnosticsSignWarning"} + {texthl = "LspDiagnosticsSignWarning", text = "īŠ", numhl = "LspDiagnosticsSignWarning"} ) vim.fn.sign_define( "LspDiagnosticsSignHint", - {texthl = "LspDiagnosticsSignHint", text = "īĒ", numhl = "LspDiagnosticsSignHint"} + {texthl = "LspDiagnosticsSignHint", text = "ī ĩ", numhl = "LspDiagnosticsSignHint"} ) vim.fn.sign_define( "LspDiagnosticsSignInformation", - {texthl = "LspDiagnosticsSignInformation", text = "ī", numhl = "LspDiagnosticsSignInformation"} + {texthl = "LspDiagnosticsSignInformation", text = "ī", numhl = "LspDiagnosticsSignInformation"} ) vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>") @@ -21,7 +21,7 @@ vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>") -vim.cmd("nnoremap <silent> K :Lspsaga hoer_doc<CR>") +vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>") -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>") @@ -31,6 +31,19 @@ vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>") vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') +-- Set Default Prefix. +-- Note: You can set a prefix per lsp server in the lv-globals.lua file +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = { + prefix = "ī", + spacing = 0, + }, + signs = true, + underline = true, + } +) + -- symbols for autocomplete vim.lsp.protocol.CompletionItemKind = { " ī (Text) ", @@ -47,7 +60,7 @@ vim.lsp.protocol.CompletionItemKind = { " īĸ (Value)", " īŠ (Enum)", " ī (Keyword)", - " īŦ (Snippet)", + " ī (Snippet)", " īŖ (Color)", " ī (File)", " ī (Reference)", @@ -87,8 +100,10 @@ local function documentHighlight(client, bufnr) end local lsp_config = {} -function lsp_config.common_on_attach(client, bufnr) - documentHighlight(client, bufnr) +if O.document_highlight then + function lsp_config.common_on_attach(client, bufnr) + documentHighlight(client, bufnr) + end end function lsp_config.tsserver_on_attach(client, bufnr) diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua index 8cc8b22..d4dfac5 100644 --- a/.config/nvim/lua/lsp/python-ls.lua +++ b/.config/nvim/lua/lsp/python-ls.lua @@ -1,3 +1,4 @@ + -- npm i -g pyright require'lspconfig'.pyright.setup { cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"}, @@ -8,7 +9,15 @@ require'lspconfig'.pyright.setup { signs = O.python.diagnostics.signs, underline = O.python.diagnostics.underline, update_in_insert = true - }) + }, + settings = { + python = { + analysis = { + typeCheckingMode = O.python.analysis.type_checking, + autoSearchPaths = O.python.analysis.auto_search_paths, + useLibraryCodeForTypes = O.python.analysis.use_library_code_types + } + } } } diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 1402d14..bc7f380 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -22,21 +22,19 @@ vim.cmd([[ -- TODO fix this -- resize with arrows -vim.cmd([[ - nnoremap <silent> <C-Up> :resize -2<CR> - nnoremap <silent> <C-Down> :resize +2<CR> - nnoremap <silent> <C-Left> :vertical resize -2<CR> - nnoremap <silent> <C-Right> :vertical resize +2<CR> -]]) +vim.api.nvim_set_keymap('n', '<C-Up>', ':resize -2<CR>', {silent = true}) +vim.api.nvim_set_keymap('n', '<C-Down>', ':resize +2<CR>', {silent = true}) +vim.api.nvim_set_keymap('n', '<C-Left>', ':vertical resize -2<CR>', {silent = true}) +vim.api.nvim_set_keymap('n', '<C-Right>', ':vertical resize +2<CR>', {silent = true}) -- better indenting vim.api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true}) vim.api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true}) -- I hate escape --- vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true}) --- vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true}) --- vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true}) -- Tab switch buffer vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', {noremap = true, silent = true}) @@ -49,3 +47,12 @@ vim.api.nvim_set_keymap('x', 'J', ':move \'>+1<CR>gv-gv', {noremap = true, silen -- Better nav for omnicomplete vim.cmd('inoremap <expr> <c-j> (\"\\<C-n>\")') vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")') + +-- fix to get netrw's gx command to work correctly +vim.api.nvim_set_keymap('n', 'gx', ":call netrw#BrowseX(expand((exists('g:netrw_gx')? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>", {noremap = true, silent = true}) + +vim.cmd('vnoremap p "0p') +vim.cmd('vnoremap P "0P') + +-- Toggle the QuickFix window +vim.api.nvim_set_keymap('', '<C-q>', ':call QuickFixToggle()<CR>', {noremap = true, silent = true}) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index e580b55..b2d6acd 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -22,9 +22,7 @@ local function require_plugin(plugin) end end -- print(ok, err, code) - if ok then - vim.cmd("packadd " .. plugin) - end + if ok then vim.cmd("packadd " .. plugin) end return ok, err, code end @@ -39,12 +37,14 @@ return require("packer").startup( use {"neovim/nvim-lspconfig", opt = true} use {"glepnir/lspsaga.nvim", opt = true} use {"kabouzeid/nvim-lspinstall", opt = true} + use {"folke/trouble.nvim", opt = true} -- Telescope use {"nvim-lua/popup.nvim", opt = true} use {"nvim-lua/plenary.nvim", opt = true} use {"nvim-telescope/telescope.nvim", opt = true} - use {"nvim-telescope/telescope-media-files.nvim", opt = true} + use {"nvim-telescope/telescope-fzy-native.nvim", opt = true} + use {"nvim-telescope/telescope-project.nvim", opt = true} -- Autocomplete use {"hrsh7th/nvim-compe", opt = true} @@ -54,18 +54,26 @@ return require("packer").startup( -- Treesitter use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"} use {"windwp/nvim-ts-autotag", opt = true} + use {'andymass/vim-matchup', opt = true} -- Explorer - use "kyazdani42/nvim-tree.lua" + use {"kyazdani42/nvim-tree.lua", opt = true} + use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you + -- TODO remove when open on dir is supported by nvimtree use "kevinhwang91/rnvimr" + + -- git + use {"lewis6991/gitsigns.nvim", opt = true} + use {'f-person/git-blame.nvim', opt = true} - use {"liuchengxu/vim-which-key", opt = true} use {"ChristianChiarulli/dashboard-nvim", opt = true} use {"windwp/nvim-autopairs", opt = true} - use {"terrortylor/nvim-comment", opt = true} use {"kevinhwang91/nvim-bqf", opt = true} + -- Comments + use {"terrortylor/nvim-comment", opt = true} + -- Icons use {"kyazdani42/nvim-web-devicons", opt = true} @@ -79,36 +87,34 @@ return require("packer").startup( -- Colorschemes use 'aktersnurra/githubsy.vim' - use {"christianchiarulli/nvcode-color-schemes.vim", opt = true} - use 'norcalli/nvim-colorizer.lua' + use {"aktersnurra/nvcode-color-schemes.vim", opt = true} use 'RRethy/nvim-base16' - -- Git - use {"lewis6991/gitsigns.nvim", opt = true} - use 'TimUntersberger/neogit' - use 'f-person/git-blame.nvim' - use 'tpope/vim-fugitive' - use 'tpope/vim-rhubarb' - -- General Plugins [my own additions] - use 'airblade/vim-rooter' use 'unblevable/quick-scope' - use 'kdav5758/TrueZen.nvim' - -- use 'vimwiki/vimwiki' + use {"Pocco81/TrueZen.nvim", opt = true} + + -- Extras + use {'nacro90/numb.nvim', opt = true} + use {'phaazon/hop.nvim', opt = true} + use {'norcalli/nvim-colorizer.lua', opt = true} require_plugin("nvim-lspconfig") require_plugin("lspsaga.nvim") require_plugin("nvim-lspinstall") + require_plugin('trouble.nvim') + require_plugin("friendly-snippets") require_plugin("popup.nvim") require_plugin("plenary.nvim") require_plugin("telescope.nvim") - require_plugin("nvim-dap") + require_plugin('telescope-project.nvim') require_plugin("nvim-compe") require_plugin("vim-vsnip") require_plugin("nvim-treesitter") - require_plugin("nvim-ts-autotag") + require_plugin('vim-matchup') require_plugin("nvim-tree.lua") require_plugin("gitsigns.nvim") + require_plugin("git-blame.nvim") require_plugin("vim-which-key") require_plugin("dashboard-nvim") require_plugin("nvim-autopairs") @@ -118,10 +124,15 @@ return require("packer").startup( require_plugin("nvim-web-devicons") require_plugin("galaxyline.nvim") require_plugin("barbar.nvim") + require_plugin('lsp-rooter.nvim') require_plugin("which-key.nvim") require_plugin("vim-rooter") + require_plugin('numb.nvim') + require_plugin('hop.nvim') + require_plugin('nvim-colorizer.lua') + require_plugin("quick-scope") - require_plugin("TrueZen") + require_plugin("TrueZen.nvim") end ) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 27b1682..0639643 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -1,8 +1,6 @@ vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. vim.cmd('set inccommand=split') -- Make substitution work in realtime -vim.cmd('setlocal indentkeys-=:') -vim.cmd('setlocal indentkeys-=:') vim.o.hidden = O.hidden_files -- Required to keep multiple buffers open multiple buffers vim.o.title = true TERMINAL = vim.fn.expand('$TERMINAL') @@ -15,15 +13,15 @@ vim.o.pumheight = 10 -- Makes popup menu smaller vim.o.fileencoding = "utf-8" -- The encoding written to file vim.o.cmdheight = 2 -- More space for displaying messages vim.cmd('set colorcolumn=99999') -- fix indentline for now -vim.o.mouse = "a" -- Enable your mouse +vim.o.mouse = "r" -- Enable your mouse vim.o.splitbelow = true -- Horizontal splits will automatically be below vim.o.termguicolors = true -- set term gui colors most terminals support this vim.o.splitright = true -- Vertical splits will automatically be to the right -vim.o.t_Co = "256" -- Support 256 colors +-- vim.o.t_Co = "256" -- Support 256 colors vim.o.conceallevel = 0 -- So that I can see `` in markdown files vim.cmd('set ts=4') -- Insert 2 spaces for a tab vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation -vim.bo.expandtab = true -- Converts tabs to spaces +vim.cmd('set expandtab') -- Converts tabs to spaces vim.bo.smartindent = true -- Makes indenting smart vim.wo.number = O.number -- set numbered lines vim.wo.relativenumber = O.relative_number -- set relative number @@ -34,6 +32,9 @@ vim.o.backup = false -- This is recommended by coc vim.o.writebackup = false -- This is recommended by coc vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time vim.o.updatetime = 300 -- Faster completion -vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms +vim.o.timeoutlen = O.timeoutlen -- By default timeoutlen is 1000 ms vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else +vim.g.nvim_tree_disable_netrw = O.nvim_tree_disable_netrw -- enable netrw for remote gx gf support (must be set before plugin's packadd) +vim.g.loaded_netrwPlugin = 1 -- needed for netrw gx command to open remote links in browser +vim.cmd('filetype plugin on') -- filetype detection vim.o.guifont = "SpaceMono Nerd Font:h17" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 3c2f7a5..8c72621 100755 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -21,10 +21,10 @@ alias \ ffmpeg="ffmpeg -hide_banner" alias \ - ls="ls -hN --color=auto --group-directories-first" \ + ls="ls -ahlN --color=auto --group-directories-first" \ grep="grep --color=auto" \ diff="diff --color=auto" -# ccat="highlight --out-format=ansi" + # ccat="highlight --out-format=ansi" # My aliases for different programs alias \ @@ -38,5 +38,5 @@ alias \ v="$EDITOR" \ p="sudo pacman" \ config="/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME" \ - tmux="tmux -f $HOME/.config/tmux/.tmux.conf" \ + tmux="tmux -f $XDG_CONFIG_HOME/tmux/.tmux.conf" \ z="zathura" diff --git a/.config/tmux/.tmux.conf b/.config/tmux/.tmux.conf index 0fda630..544585a 100644 --- a/.config/tmux/.tmux.conf +++ b/.config/tmux/.tmux.conf @@ -1,13 +1,28 @@ -# show session, window, pane in left status bar -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-yank' -set -g @plugin "arcticicestudio/nord-tmux" +# Load tmux config +bind r source-file $HOME/.config/tmux/.tmux.conf + +# Bind prefix to C-a +set-option -g prefix C-a +unbind-key C-b +bind-key C-a send-prefix + +# Default shell +set-option -g default-shell /usr/bin/zsh # Allows vim to display colors correctly. set -g default-terminal 'screen-256color' set -ga terminal-overrides ',*256col*:Tc' -set -g status off +# Status line +set -g status on +set-option -g status-style bg=#121212,fg=white +set-option -g automatic-rename on +set-option -g renumber-windows on +set-option -g status-left "" +set -ga status-left '#[bg=black]#[fg=white] #{?window_zoomed_flag,īĄ, }' +set-option -g status-right "" +set-option -g window-status-format " #{window_index}#(echo ':')#{window_name}#{window_flag} " +set-option -g window-status-current-format " #[bold,bg=#1c1c1c] #{window_index}#(echo ':')#{window_name}#{window_flag} " #set -g default-terminal screen-256color set -g status-keys vi @@ -15,10 +30,8 @@ set -g history-limit 10000 setw -g mode-keys vi setw -g mouse off -#setw -g monitor-activity on -#setw -g alternate-screen on -# split panes using | and - +# split panes bind s split-window -h bind v split-window -v unbind '"' @@ -59,10 +72,3 @@ set -g base-index 1 # No delay for escape key press set -sg escape-time 0 - -# Reload tmux config -bind r source-file $HOME/.config/tmux/.tmux.conf - -if-shell 'test "$SSH_CONNECTION"' 'set -g status-bg red' - -run '~/.config/tmux/plugins/tpm/tpm' |