diff options
34 files changed, 840 insertions, 6 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..d0e013a --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,45 @@ +-- General mappings +require('plugins') +require('mappings') +require('settings') +require('colorscheme') + +-- Plugins +require('_compe') +require('_telescope') +require('autopairs') +require('_bufferline') +require('closetag') +require('colorizer') +require('floaterm') +require('galaxyline') +require('gitblame') +require('gitsigns') +require('hop') +require('kommentary') +-- require('limeligth') +require('neogit') +require('nvimtree') +require('quickscope') +require('rnvimr') +require('startify') +require('treesitter') +require('vim-rooter') + + +-- Load vim scripts +-- Which Key (Hope to replace with Lua plugin someday) +vim.cmd('source ~/.config/nvim/lua/whichkey/init.vim') +vim.cmd('source ~/.config/nvim/lua/goyo/init.vim') +vim.cmd('source ~/.config/nvim/lua/vim-bbye/init.vim') + +-- LSP +require('lspkind') +require('lsp') +require('utils') +require('lsp.bash-ls') +require('lsp.docker-ls') +require('lsp.lua-ls') +require('lsp.json-ls') +require('lsp.python-ls') +require('lsp.yaml-ls') diff --git a/.config/nvim/lua/bufferline/init.lua b/.config/nvim/lua/_bufferline/init.lua index ab7ecae..ab7ecae 100644 --- a/.config/nvim/lua/bufferline/init.lua +++ b/.config/nvim/lua/_bufferline/init.lua diff --git a/.config/nvim/lua/_telescope/init.lua b/.config/nvim/lua/_telescope/init.lua index 4dfa57f..7466cd4 100644 --- a/.config/nvim/lua/_telescope/init.lua +++ b/.config/nvim/lua/_telescope/init.lua @@ -12,7 +12,7 @@ require('telescope').setup { entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", - sorting_strategy = "descending", + sorting_strategy = "ascending", layout_strategy = "horizontal", layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, file_sorter = require'telescope.sorters'.get_fuzzy_file, diff --git a/.config/nvim/lua/autopairs/init.lua b/.config/nvim/lua/autopairs/init.lua new file mode 100644 index 0000000..6810a77 --- /dev/null +++ b/.config/nvim/lua/autopairs/init.lua @@ -0,0 +1,40 @@ +require('nvim-autopairs').setup() + +local pairs_map = { + ["'"] = "'", + ['"'] = '"', + ['('] = ')', + ['['] = ']', + ['{'] = '}', + ['`'] = '`', +} +local disable_filetype = { "TelescopePrompt" } +local break_line_filetype = nil -- mean all file type +local html_break_line_filetype = {'html' , 'vue' , 'typescriptreact' , 'svelte' , 'javascriptreact'} +local ignored_next_char = "%w" + +local remap = vim.api.nvim_set_keymap +local npairs = require('nvim-autopairs') + +-- skip it, if you use another global object +_G.MUtils= {} + +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>") + else + vim.defer_fn(function() + vim.fn["compe#confirm"]("<cr>") + end, 20) + return npairs.esc("<c-n>") + end + else + return npairs.check_break_line_char() + end +end + + +remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) diff --git a/.config/nvim/lua/barbar/init.lua b/.config/nvim/lua/barbar/init.lua new file mode 100644 index 0000000..e4eb06b --- /dev/null +++ b/.config/nvim/lua/barbar/init.lua @@ -0,0 +1,118 @@ +vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true }) +--[[ nnoremap <silent> <A-,> :BufferPrevious<CR> +nnoremap <silent> <A-.> :BufferNext<CR> ]] + + +--" These commands will sort buffers by directory, language, or a custom criteria +--nnoremap <silent>be :BufferLineSortByExtension<CR> +--nnoremap <silent>bd :BufferLineSortByDirectory<CR> +--nnoremap <silent><mymap> :lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)<CR> +-- colors for active , inactive buffer tabs +--[[ require "bufferline".setup { + options = { + -- buffer_close_icon = "", + -- modified_icon = "●", + -- close_icon = "", + -- left_trunc_marker = "", + -- right_trunc_marker = "", + -- max_name_length = 14, + -- max_prefix_length = 13, + -- tab_size = 18, + -- enforce_regular_tabs = true, + -- view = "multiwindow", + -- show_buffer_close_icons = true, + -- separator_style = 'slant' + separator_style = "thin" + }, + highlights = { + background = { + guifg = "#abb2bf", + guibg = "#282c34" + }, + fill = { + guifg = "#282c34", + guibg = "#1e1e1e" + }, + buffer_selected = { + guifg = "#abb2bf", + guibg = "#3A3E44", + gui = "bold" + }, + buffer_selected = { + guifg = "#abb2bf", + guibg = "#3A3E44", + gui = "bold" + }, + separator_visible = { + guifg = "#1e1e1e", + guibg = "#1e1e1e" + }, + separator_selected = { + guifg = "#1e1e1e", + guibg = "#1e1e1e" + }, + separator = { + guifg = "#1e1e1e", + guibg = "#1e1e1e" + }, + indicator_selected = { + guifg = "#abb2bf", + guibg = "#3a3e44" + }, + modified_selected = { + guifg = "#abb2bf", + guibg = "#3a3e44" + }, + modified = { + guifg = "#abb2bf", + guibg = "#282c34" + }, + modified_visible = { + guifg = "#abb2bf", + guibg = "#282c34" + }, + duplicate_selected = { + guifg = "#abb3bf", + guibg = "#3a3e44", + -- gui = "italic" + }, + duplicate_visible = { + guifg = "#abb3bf", + guibg = "#282c34", + -- gui = "italic" + }, + duplicate = { + guifg = "#abb3bf", + guibg = "#282c34", + -- gui = "italic" + }, + tab = { + guifg = "#abb3bf", + guibg = "#282c34", + }, + tab_selected = { + guifg = "#abb3bf", + guibg = "#282c34", + }, + tab_close = { + guifg = "#abb3bf", + guibg = "#282c34", + }, + pick_selected = { + guifg = "#abb3bf", + guibg = "#282c34", + gui = "bold,italic" + }, + pick_visible = { + guifg = "#abb3bf", + guibg = "#282c34", + gui = "bold,italic" + }, + pick = { + guifg = "#abb3bf", + guibg = "#282c34", + gui = "bold,italic" + } + } +} ]] diff --git a/.config/nvim/lua/closetag/init.lua b/.config/nvim/lua/closetag/init.lua new file mode 100644 index 0000000..8c11641 --- /dev/null +++ b/.config/nvim/lua/closetag/init.lua @@ -0,0 +1,3 @@ +vim.g.closetag_filenames = '*.html,*.xhtml,*.phtml' +vim.g.closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js' +vim.g.closetag_filetypes = 'html,xhtml,phtml,javascript,javascriptreact' diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua new file mode 100644 index 0000000..7758392 --- /dev/null +++ b/.config/nvim/lua/colorscheme.lua @@ -0,0 +1,7 @@ +vim.api.nvim_command([[ + augroup ChangeBackgroudColour + autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE + augroup END +]]) +vim.cmd('colorscheme githubsy') +vim.cmd('let g:nvcode_termcolors=256') diff --git a/.config/nvim/lua/floaterm/init.lua b/.config/nvim/lua/floaterm/init.lua new file mode 100644 index 0000000..633df35 --- /dev/null +++ b/.config/nvim/lua/floaterm/init.lua @@ -0,0 +1,13 @@ +-- Floaterm +vim.g.floaterm_keymap_toggle = '<F1>' +vim.g.floaterm_keymap_next = '<F2>' +vim.g.floaterm_keymap_prev = '<F3>' +vim.g.floaterm_keymap_new = '<F4>' +vim.g.floaterm_title='' + +vim.g.floaterm_gitcommit='floaterm' +vim.g.floaterm_autoinsert=1 +vim.g.floaterm_width=0.8 +vim.g.floaterm_height=0.8 +vim.g.floaterm_wintitle=0 +vim.g.floaterm_autoclose=1 diff --git a/.config/nvim/lua/gitblame/init.lua b/.config/nvim/lua/gitblame/init.lua new file mode 100644 index 0000000..12645a7 --- /dev/null +++ b/.config/nvim/lua/gitblame/init.lua @@ -0,0 +1,2 @@ +vim.cmd('highlight default link gitblame SpecialComment') +vim.g.gitblame_enabled = 0 diff --git a/.config/nvim/lua/gitsigns/init.lua b/.config/nvim/lua/gitsigns/init.lua new file mode 100644 index 0000000..b435be7 --- /dev/null +++ b/.config/nvim/lua/gitsigns/init.lua @@ -0,0 +1,36 @@ +require('gitsigns').setup { + signs = { + -- TODO add hl to colorscheme + add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + + --[[ ['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"}, + ['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', + ['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>', + ['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', + ['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', + ['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>', ]] + + -- Text objects + --[[ ['o ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>', + ['x ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>' ]] + }, + watch_index = { + interval = 1000 + }, + sign_priority = 6, + update_debounce = 200, + status_formatter = nil, -- Use default + use_decoration_api = false +} diff --git a/.config/nvim/lua/goyo/init.vim b/.config/nvim/lua/goyo/init.vim new file mode 100644 index 0000000..f617194 --- /dev/null +++ b/.config/nvim/lua/goyo/init.vim @@ -0,0 +1,2 @@ +autocmd! User GoyoEnter Limelight lua require('galaxyline').disable_galaxyline() +autocmd! User GoyoLeave Limelight! lua require('galaxyline').galaxyline_augroup() diff --git a/.config/nvim/lua/hop/init.lua b/.config/nvim/lua/hop/init.lua new file mode 100644 index 0000000..f7dd27d --- /dev/null +++ b/.config/nvim/lua/hop/init.lua @@ -0,0 +1,2 @@ +vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {}) +vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {}) diff --git a/.config/nvim/lua/kommentary/init.lua b/.config/nvim/lua/kommentary/init.lua new file mode 100644 index 0000000..dea90f7 --- /dev/null +++ b/.config/nvim/lua/kommentary/init.lua @@ -0,0 +1,6 @@ +vim.g.kommentary_create_default_mappings = false +vim.api.nvim_set_keymap("n", "<leader>/", "<Plug>kommentary_line_default", {}) +vim.api.nvim_set_keymap("v", "<leader>/", "<Plug>kommentary_visual_default", {}) +require('kommentary.config').configure_language("default", { + prefer_single_line_comments = true, +}) diff --git a/.config/nvim/lua/lsp/bash.lua b/.config/nvim/lua/lsp/bash-ls.lua index 8be0383..8be0383 100644 --- a/.config/nvim/lua/lsp/bash.lua +++ b/.config/nvim/lua/lsp/bash-ls.lua diff --git a/.config/nvim/lua/lsp/docker.lua b/.config/nvim/lua/lsp/docker-ls.lua index ad6e220..ad6e220 100644 --- a/.config/nvim/lua/lsp/docker.lua +++ b/.config/nvim/lua/lsp/docker-ls.lua diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua new file mode 100644 index 0000000..4515e7c --- /dev/null +++ b/.config/nvim/lua/lsp/init.lua @@ -0,0 +1,19 @@ +--TODO figure out why this don't work +vim.fn.sign_define("LspDiagnosticsSignError", {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}) +vim.fn.sign_define("LspDiagnosticsSignWarning", {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}) +vim.fn.sign_define("LspDiagnosticsSignInformation", {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}) +vim.fn.sign_define("LspDiagnosticsSignHint", {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}) + +vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>') +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 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>') +-- scroll down hover doc or scroll in definition preview +vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>') +-- scroll up hover doc +vim.cmd('nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>') diff --git a/.config/nvim/lua/lsp/json.lua b/.config/nvim/lua/lsp/json-ls.lua index d13fed3..d13fed3 100644 --- a/.config/nvim/lua/lsp/json.lua +++ b/.config/nvim/lua/lsp/json-ls.lua diff --git a/.config/nvim/lua/lsp/lsp-config.lua b/.config/nvim/lua/lsp/lsp-config.lua deleted file mode 100644 index fe5dfb7..0000000 --- a/.config/nvim/lua/lsp/lsp-config.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"}) -vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) -vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) -vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua-ls.lua index c04219a..c04219a 100644 --- a/.config/nvim/lua/lsp/lua.lua +++ b/.config/nvim/lua/lsp/lua-ls.lua diff --git a/.config/nvim/lua/lsp/python.lua b/.config/nvim/lua/lsp/python-ls.lua index 11eeef9..11eeef9 100644 --- a/.config/nvim/lua/lsp/python.lua +++ b/.config/nvim/lua/lsp/python-ls.lua diff --git a/.config/nvim/lua/lsp/yaml.lua b/.config/nvim/lua/lsp/yaml-ls.lua index 904f20e..904f20e 100644 --- a/.config/nvim/lua/lsp/yaml.lua +++ b/.config/nvim/lua/lsp/yaml-ls.lua diff --git a/.config/nvim/lua/lsp/lsp-kind.lua b/.config/nvim/lua/lspkind/init.lua index de928c2..e3c590f 100644 --- a/.config/nvim/lua/lsp/lsp-kind.lua +++ b/.config/nvim/lua/lspkind/init.lua @@ -1,4 +1,4 @@ --- commented options are defaults +-- symbols for autocomplete require('lspkind').init({ with_text = false, symbol_map = { diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..1233bf3 --- /dev/null +++ b/.config/nvim/lua/mappings.lua @@ -0,0 +1,66 @@ +vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', { noremap = true, silent = true }) +vim.g.mapleader = ' ' + +-- no hl +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 }) + + +-- better window movement +vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', { silent = true }) +vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', { silent = true }) +vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', { silent = true }) +vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', { silent = true }) + +-- TODO fix this +-- Terminal window navigation +vim.cmd([[ + tnoremap <C-h> <C-\><C-N><C-w>h + tnoremap <C-j> <C-\><C-N><C-w>j + tnoremap <C-k> <C-\><C-N><C-w>k + tnoremap <C-l> <C-\><C-N><C-w>l + inoremap <C-h> <C-\><C-N><C-w>h + inoremap <C-j> <C-\><C-N><C-w>j + inoremap <C-k> <C-\><C-N><C-w>k + inoremap <C-l> <C-\><C-N><C-w>l + tnoremap <Esc> <C-\><C-n> +]]) + +-- 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> +]]) + + +-- 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 }) + +-- Tab switch buffer +vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<S-TAB>', ':bprevious<CR>', { noremap = true, silent = true }) + +-- Move selected line / block of text in visual mode +vim.api.nvim_set_keymap('x', 'K', ':move \'<-2<CR>gv-gv', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('x', 'J', ':move \'>+1<CR>gv-gv', { noremap = true, silent = true }) + + +-- Better nav for omnicomplete +vim.cmd('inoremap <expr> <c-j> (\"\\<C-n>\")') +vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")') +-- vim.cmd('inoremap <expr> <TAB> (\"\\<C-n>\")') +-- vim.cmd('inoremap <expr> <S-TAB> (\"\\<C-p>\")') + +-- TAB Complete +--vim.api.nvim_set_keymap('i', '<expr><TAB>', 'pumvisible() ? \"\\<C-n>\" : \"\\<TAB>\"', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/neogit/init.lua b/.config/nvim/lua/neogit/init.lua new file mode 100644 index 0000000..ca38081 --- /dev/null +++ b/.config/nvim/lua/neogit/init.lua @@ -0,0 +1 @@ +local neogit = require('neogit') diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..9bcec6c --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,99 @@ +local execute = vim.api.nvim_command +local fn = vim.fn + +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + + +if fn.empty(fn.glob(install_path)) > 0 then + execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) + execute 'packadd packer.nvim' +end + + +return require('packer').startup(function() + -- Packer can manage itself as an optional plugin + use {'wbthomason/packer.nvim'} + + -- Information + use 'nanotee/nvim-lua-guide' + + -- Quality of life improvements + use 'norcalli/nvim_utils' + + -- LSP + use 'neovim/nvim-lspconfig' + use 'glepnir/lspsaga.nvim' + use 'onsails/lspkind-nvim' + use 'kosayoda/nvim-lightbulb' + + -- Debugging + use 'mfussenegger/nvim-dap' + + -- Autocomplete + use 'hrsh7th/nvim-compe' + use 'hrsh7th/vim-vsnip' + use 'hrsh7th/vim-vsnip-integ' + + -- Treesitter + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + use 'nvim-treesitter/playground' + use 'p00f/nvim-ts-rainbow' + + -- Icons + use 'kyazdani42/nvim-web-devicons' + use 'ryanoasis/vim-devicons' + + -- Status Line and Bufferline + use 'glepnir/galaxyline.nvim' + use {'akinsho/nvim-bufferline.lua', requires = 'kyazdani42/nvim-web-devicons'} + use 'romgrk/barbar.nvim' + + -- Telescope + use 'nvim-lua/popup.nvim' + use 'nvim-lua/plenary.nvim' + use 'nvim-telescope/telescope.nvim' + use 'nvim-telescope/telescope-media-files.nvim' + + -- Explorer + use 'kyazdani42/nvim-tree.lua' + + + -- Color + use 'aktersnurra/githubsy.vim' + use 'christianchiarulli/nvcode-color-schemes.vim' + use 'norcalli/nvim-colorizer.lua' + + -- Git + use 'TimUntersberger/neogit' + use {'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } + use 'f-person/git-blame.nvim' + + -- Easily Create Gists + use 'mattn/vim-gist' + use 'mattn/webapi-vim' + + -- General Plugins + use 'windwp/nvim-autopairs' + use 'kevinhwang91/nvim-bqf' + use 'unblevable/quick-scope' + use 'airblade/vim-rooter' + use 'b3nj5m1n/kommentary' + use 'kevinhwang91/rnvimr' + use 'mhinz/vim-startify' + use 'metakirby5/codi.vim' + use 'psliwka/vim-smoothie' + use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'} + use 'moll/vim-bbye' + use 'turbio/bracey.vim' + use 'AndrewRadev/tagalong.vim' + use 'alvan/vim-closetag' + use { 'glacambre/firenvim', run = function() vim.fn['firenvim#install'](1) end } + use 'liuchengxu/vim-which-key' + use 'tpope/vim-sleuth' + use 'voldikss/vim-floaterm' + use 'phaazon/hop.nvim' + use 'junegunn/goyo.vim' + use 'junegunn/limelight.vim' + use 'vimwiki/vimwiki' + use 'kosayoda/nvim-lightbulb' +end) diff --git a/.config/nvim/lua/quickscope/init.lua b/.config/nvim/lua/quickscope/init.lua new file mode 100644 index 0000000..4c70669 --- /dev/null +++ b/.config/nvim/lua/quickscope/init.lua @@ -0,0 +1,7 @@ +-- 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/rnvimr/init.lua b/.config/nvim/lua/rnvimr/init.lua new file mode 100644 index 0000000..055326c --- /dev/null +++ b/.config/nvim/lua/rnvimr/init.lua @@ -0,0 +1,22 @@ +-- Make Ranger replace netrw and be the file explorer +vim.g.rnvimr_ex_enable = 1 +vim.g.rnvimr_draw_border = 1 + +-- Make Ranger to be hidden after picking a file +vim.g.rnvimr_pick_enable = 1 + +-- Make Neovim to wipe the buffers corresponding to the files deleted by Ranger +vim.g.rnvimr_bw_enable = 1 + +-- vim.cmd('nmap <leader>r :RnvimrToggle<CR>') + +--[[ let g:rnvimr_ranger_cmd = 'ranger --cmd="set column_ratios 1,1"' + " \ --cmd="set draw_borders separators"' +" let g:rnvimr_layout = { 'relative': 'editor', +" \ 'width': float2nr(round(0.6 * &columns)), +" \ 'height': float2nr(round(0.6 * &lines)), +" \ 'col': float2nr(round(0.2 * &columns)), +" \ 'row': float2nr(round(0.2 * &lines)), +" \ 'style': 'minimal' } +let g:rnvimr_presets = [ + \ {'width': 0.800, 'height': 0.800}] ]] diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..7ad52c6 --- /dev/null +++ b/.config/nvim/lua/settings.lua @@ -0,0 +1,36 @@ +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.o.hidden=true --Required to keep multiple buffers open multiple buffers +vim.wo.wrap=false --Display long lines as just one line +vim.cmd('set whichwrap+=<,>,[,],h,l') +vim.o.encoding="utf-8" --The encoding displayed +vim.o.pumheight=10 --Makes popup menu smaller +vim.o.fileencoding="utf-8" --The encoding written to file +vim.o.ruler=true -- " Show the cursor position all the time +vim.o.cmdheight=2 --More space for displaying messages +vim.o.mouse="a" --Enable your mouse +vim.o.splitbelow=true --Horizontal splits will automatically be below +vim.o.termguicolors=true +vim.o.splitright=true --Vertical splits will automatically be to the right +vim.o.t_Co="256" --Support 256 colors +vim.o.conceallevel=0 --So that I can see `` in markdown files +vim.o.tabstop=2 --Insert 2 spaces for a tab +vim.o.shiftwidth=2 --Change the number of space characters inserted for indentation +vim.o.smarttab=true --Makes tabbing smarter will realize you have 2 vs 4 +vim.o.expandtab=true --Converts tabs to spaces +vim.o.smartindent=true --Makes indenting smart +vim.o.autoindent=true --Good auto indent +vim.o.laststatus=2 --Always display the status line +vim.wo.number = true +vim.o.cursorline=true --Enable highlighting of the current line +vim.o.background="dark" --tell vim what the background color looks like +vim.o.showtabline=2 --Always show tabs +vim.o.showmode=false --We don't need to see things like -- INSERT -- anymore +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=100 --By default timeoutlen is 1000 ms +vim.o.clipboard="unnamedplus" --Copy paste between vim and everything else +vim.o.incsearch=true +vim.o.guifont="SpaceMono\\ Nerd\\ Font\\ Mono:h18" diff --git a/.config/nvim/lua/startify/init.lua b/.config/nvim/lua/startify/init.lua new file mode 100644 index 0000000..9b1488b --- /dev/null +++ b/.config/nvim/lua/startify/init.lua @@ -0,0 +1,41 @@ +vim.g.startify_custom_header = { + ' ##############..... ############## ', + ' ##############......############## ', + ' ##########..........########## ', + ' ##########........########## ', + ' ##########.......########## ', + ' ##########.....##########.. ', + ' ##########....##########..... ', + ' ..##########..##########......... ', + ' ....##########.#########............. ', + ' ..################JJJ............ ', + ' ################............. ', + ' ##############.JJJ.JJJJJJJJJJ ', + ' ############...JJ...JJ..JJ JJ ', + ' ##########....JJ...JJ..JJ JJ ', + ' ########......JJJ..JJJ JJJ JJJ ', + ' ###### ......... ', + ' ..... ', + ' . ', + } + +vim.g.webdevicons_enable_startify = 1 +vim.g.startify_enable_special = 0 +vim.g.startify_session_dir = '~/.config/nvim/session' +vim.g.startify_session_autoload = 1 +vim.g.startify_session_delete_buffers = 1 +vim.g.startify_change_to_vcs_root = 1 +vim.g.startify_fortune_use_unicode = 1 +vim.g.startify_session_persistence = 1 +vim.g.startify_session_dir = '~/.config/nvim/session' + + +vim.api.nvim_exec('let startify_lists = [ { \'type\': \'files\', \'header\': [\' Files\'] }, { \'type\': \'sessions\', \'header\': [\' Sessions\'] }, { \'type\': \'bookmarks\', \'header\': [\' Bookmarks\'] }, ]',true) + +vim.api.nvim_exec('let startify_bookmarks = [ { \'b\': \'~/Blog\' }, { \'i\': \'~/.config/nvim/init.vim\' }, { \'z\': \'~/.zshrc\' }]', true) + +vim.cmd([[ +function! StartifyEntryFormat() + return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path' +endfunction +]]) diff --git a/.config/nvim/lua/utils.lua b/.config/nvim/lua/utils.lua new file mode 100644 index 0000000..b5f1413 --- /dev/null +++ b/.config/nvim/lua/utils.lua @@ -0,0 +1,31 @@ +local function define_augroups(definitions) -- {{{1 + -- Create autocommand groups based on the passed definitions + -- + -- The key will be the name of the group, and each definition + -- within the group should have: + -- 1. Trigger + -- 2. Pattern + -- 3. Text + -- just like how they would normally be defined from Vim itself + for group_name, definition in pairs(definitions) do + vim.cmd('augroup ' .. group_name) + vim.cmd('autocmd!') + + for _, def in pairs(definition) do + local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ') + vim.cmd(command) + end + + vim.cmd('augroup END') + end +end + +define_augroups( + {_general_settings = { + {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'IncSearch\', 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'}, + }, + } +) diff --git a/.config/nvim/lua/vim-bbye/init.vim b/.config/nvim/lua/vim-bbye/init.vim new file mode 100644 index 0000000..10ee440 --- /dev/null +++ b/.config/nvim/lua/vim-bbye/init.vim @@ -0,0 +1 @@ +nnoremap <Leader>q :Bdelete<CR> diff --git a/.config/nvim/lua/vim-pydocstring/init.vim b/.config/nvim/lua/vim-pydocstring/init.vim new file mode 100644 index 0000000..e3d5311 --- /dev/null +++ b/.config/nvim/lua/vim-pydocstring/init.vim @@ -0,0 +1 @@ +let g:pydocstring_formatter = 'google' diff --git a/.config/nvim/lua/vim-rooter/init.lua b/.config/nvim/lua/vim-rooter/init.lua new file mode 100644 index 0000000..a873194 --- /dev/null +++ b/.config/nvim/lua/vim-rooter/init.lua @@ -0,0 +1,2 @@ +-- TODO create file +vim.g.rooter_silent_chdir = 1 diff --git a/.config/nvim/lua/whichkey/init.vim b/.config/nvim/lua/whichkey/init.vim new file mode 100644 index 0000000..5491991 --- /dev/null +++ b/.config/nvim/lua/whichkey/init.vim @@ -0,0 +1,238 @@ +" Leader Key Maps + +" Timeout +let g:which_key_timeout = 100 + +let g:which_key_display_names = {'<CR>': '↵', '<TAB>': '⇆'} + +" Map leader to which_key +nnoremap <silent> <leader> :silent <c-u> :silent WhichKey '<Space>'<CR> +vnoremap <silent> <leader> :silent <c-u> :silent WhichKeyVisual '<Space>'<CR> + +let g:which_key_map = {} +let g:which_key_sep = '→' + +" Not a fan of floating windows for this +let g:which_key_use_floating_win = 0 +let g:which_key_max_size = 0 + +" Hide status line +autocmd! FileType which_key +autocmd FileType which_key set laststatus=0 noshowmode noruler + \| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler + + +" Single mappings +" let g:which_key_map['/'] = [ ':call Comment()' , 'comment' ] +" let g:which_key_map['/'] = { 'name' : 'comment' } +let g:which_key_map['/'] = 'which_key_ignore' +let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] +let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] +let g:which_key_map['h'] = [ '<C-W>s' , 'split below'] +let g:which_key_map['n'] = [ ':let @/ = ""' , 'no highlight' ] +let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] +" TODO create entire treesitter section +let g:which_key_map['T'] = [ ':TSHighlightCapturesUnderCursor' , 'treesitter highlight' ] +let g:which_key_map['v'] = [ '<C-W>v' , 'split right'] +" Add Zen mode, play nice with status line +" let g:which_key_map['z'] = [ 'Goyo' , 'zen' ] + +" Group mappings + +" a is for actions +let g:which_key_map.a = { + \ 'name' : '+actions' , + \ 'c' : [':ColorizerToggle' , 'colorizer'], + \ 'e' : [':CocCommand explorer' , 'explorer'], + \ 'h' : [':let @/ = ""' , 'remove search highlight'], + \ 'l' : [':Bracey' , 'start live server'], + \ 'L' : [':BraceyStop' , 'stop live server'], + \ 'm' : [':MarkdownPreview' , 'markdown preview'], + \ 'M' : [':MarkdownPreviewStop' , 'markdown preview stop'], + \ 'n' : [':set nonumber!' , 'line-numbers'], + \ 's' : [':s/\%V\(.*\)\%V/"\1"/' , 'surround'], + \ 'r' : [':set norelativenumber!' , 'relative line nums'], + \ 't' : [':FloatermToggle' , 'terminal'], + \ 'v' : [':Codi' , 'virtual repl on'], + \ 'V' : [':Codi!' , 'virtual repl off'], + \ 'w' : [':StripWhitespace' , 'strip whitespace'], + \ } + +" b is for buffer +" let g:which_key_map.b = { +" \ 'name' : '+buffer' , +" \ '>' : [':BufferMoveNext' , 'move next'], +" \ '<' : [':BufferMovePrevious' , 'move prev'], +" \ 'b' : [':BufferPick' , 'pick buffer'], +" \ 'd' : [':Bdelete' , 'delete-buffer'], +" \ 'n' : ['bnext' , 'next-buffer'], +" \ 'p' : ['bprevious' , 'previous-buffer'], +" \ '?' : ['Buffers' , 'fzf-buffer'], +" \ } + +" d is for debug +" let g:which_key_map.d = { +" \ 'name' : '+debug' , +" \ 'b' : ['<Plug>VimspectorToggleBreakpoint' , 'breakpoint'], +" \ 'B' : ['<Plug>VimspectorToggleConditionalBreakpoint' , 'conditional breakpoint'], +" \ 'c' : ['<Plug>VimspectorRunToCursor' , 'run to cursor'], +" \ 'd' : ['<Plug>VimspectorContinue' , 'continue'], +" \ 'f' : ['<Plug>VimspectorAddFunctionBreakpoint' , 'function breakpoint'], +" \ 'm' : [':MaximizerToggle' , 'maximize window'], +" \ 'o' : ['<Plug>VimspectorStepOver' , 'step over'], +" \ 'O' : ['<Plug>VimspectorStepOut' , 'step out'], +" \ 'i' : ['<Plug>VimspectorStepInto' , 'step into'], +" \ 'p' : ['<Plug>VimspectorPause' , 'pause'], +" \ 'r' : ['<Plug>VimspectorRestart' , 'restart'], +" \ 's' : ['<Plug>VimspectorStop' , 'stop'], +" \ } + +" F is for fold +let g:which_key_map.F = { + \ 'name': '+fold', + \ 'O' : [':set foldlevel=20', 'open all'], + \ 'C' : [':set foldlevel=0', 'close all'], + \ 'c' : [':foldclose', 'close'], + \ 'o' : [':foldopen', 'open'], + \ '1' : [':set foldlevel=1', 'level1'], + \ '2' : [':set foldlevel=2', 'level2'], + \ '3' : [':set foldlevel=3', 'level3'], + \ '4' : [':set foldlevel=4', 'level4'], + \ '5' : [':set foldlevel=5', 'level5'], + \ '6' : [':set foldlevel=6', 'level6'] + \ } + +" s is for search powered by telescope +let g:which_key_map.s = { + \ 'name' : '+search' , + \ '.' : [':Telescope filetypes' , 'filetypes'], + \ ';' : [':Telescope commands' , 'commands'], + \ 'a' : [':Telescope lsp_code_actions' , 'code_actions'], + \ 'A' : [':Telescope builtin' , 'all'], + \ 'b' : [':Telescope buffers' , 'buffers'], + \ 'B' : [':Telescope git_branches' , 'git branches'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], + \ 'c' : [':Telescope git_commits' , 'git_commits'], + \ 'C' : [':Telescope git_bcommits' , 'git_bcommits'], + \ 'f' : [':Telescope find_files' , 'files'], + \ 'F' : [':Telescope git_files' , 'git_files'], + \ 'g' : [':Telescope tags' , 'tags'], + \ 'G' : [':Telescope current_buffer_tags' , 'buffer_tags'], + \ 'h' : [':Telescope command_history' , 'history'], + \ 'H' : [':Telescope help_tags' , 'help_tags'], + \ 'i' : [':Telescope media_files' , 'media files'], + \ 'k' : [':Telescope keymaps' , 'keymaps'], + \ 'l' : [':Telescope loclist' , 'loclist'], + \ 'm' : [':Telescope marks' , 'marks'], + \ 'M' : [':Telescope man_pages' , 'man_pages'], + \ 'o' : [':Telescope vim_options' , 'vim_options'], + \ 'O' : [':Telescope oldfiles' , 'oldfiles'], + \ 'p' : [':Telescope fd' , 'fd'], + \ 'P' : [':Telescope spell_suggest' , 'spell_suggest'], + \ 's' : [':Telescope git_status' , 'git_status'], + \ 'S' : [':Telescope grep_string' , 'grep_string'], + \ 't' : [':Telescope live_grep' , 'text'], + \ 'y' : [':Telescope symbols' , 'symbols'], + \ 'Y' : [':Telescope lsp_workspace_symbols' , 'lsp_workspace_symbols'], + \ 'r' : [':Telescope registers' , 'registers'], + \ 'R' : [':Telescope reloader' , 'reloader'], + \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], + \ 'u' : [':Telescope colorscheme' , 'colorschemes'], + \ 'z' : [':Telescope current_buffer_fuzzy_find' , 'buf_fuz_find'], + \ } + +let g:which_key_map.S = { + \ 'name' : '+Session' , + \ 'c' : [':SClose' , 'Close Session'] , + \ 'd' : [':SDelete' , 'Delete Session'] , + \ 'l' : [':SLoad' , 'Load Session'] , + \ 's' : [':Startify' , 'Start Page'] , + \ 'S' : [':SSave' , 'Save Session'] , + \ } + +" g is for git +" let g:which_key_map.g = { +" \ 'name' : '+git' , +" \ 'a' : [':Git add .' , 'add all'], +" \ 'A' : [':CocCommand fzf-preview.GitStatus' , 'actions'], +" \ 'b' : [':Git blame' , 'blame'], +" \ 'B' : [':GBrowse' , 'browse'], +" \ 'c' : [':Git commit' , 'commit'], +" \ 'd' : [':Git diff' , 'diff'], +" \ 'D' : [':Gdiffsplit' , 'diff split'], +" \ 'g' : [':GGrep' , 'git grep'], +" \ 'G' : [':Gstatus' , 'status'], +" \ 'h' : [':GitGutterLineHighlightsToggle' , 'highlight hunks'], +" \ 'H' : ['<Plug>(GitGutterPreviewHunk)' , 'preview hunk'], +" \ 'i' : [':Gist -b' , 'post gist'], +" \ 'j' : ['<Plug>(GitGutterNextHunk)' , 'next hunk'], +" \ 'k' : ['<Plug>(GitGutterPrevHunk)' , 'prev hunk'], +" \ 'l' : [':Git log' , 'log'], +" \ 'm' : ['<Plug>(git-messenger)' , 'message'], +" \ 'p' : [':Git push' , 'push'], +" \ 'P' : [':Git pull' , 'pull'], +" \ 'r' : [':GRemove' , 'remove'], +" \ 's' : ['<Plug>(GitGutterStageHunk)' , 'stage hunk'], +" \ 'S' : [':CocCommand fzf-preview.GitStatus' , 'status'], +" \ 't' : [':GitGutterSignsToggle' , 'toggle signs'], +" \ 'u' : ['<Plug>(GitGutterUndoHunk)' , 'undo hunk'], +" \ 'v' : [':GV' , 'view commits'], +" \ 'V' : [':GV!' , 'view buffer commits'], +" \ } + " \ 'A' : [':Git add %' , 'add current'], + " \ 'S' : [':!git status' , 'status'], + +" let g:which_key_map.G = { +" \ 'name' : '+gist' , +" \ 'a' : [':Gist -a' , 'post gist anon'], +" \ 'b' : [':Gist -b' , 'post gist browser'], +" \ 'd' : [':Gist -d' , 'delete gist'], +" \ 'e' : [':Gist -e' , 'edit gist'], +" \ 'l' : [':Gist -l' , 'list public gists'], +" \ 's' : [':Gist -ls' , 'list starred gists'], +" \ 'm' : [':Gist -m' , 'post gist all buffers'], +" \ 'p' : [':Gist -P' , 'post public gist '], +" \ 'P' : [':Gist -p' , 'post private gist '], +" \ } + +" l is for language server protocol +let g:which_key_map.l = { + \ 'name' : '+lsp' , + \ 'a' : [':Lspsaga code_action' , 'quickfix'], + \ 'A' : [':Lspsaga range_code_action' , 'selected action'], + \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], + \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], + \ 'f' : [':LspFormatting' , 'format'], + \ 'H' : [':Lspsaga signature_help' , 'signature_help'], + \ 'I' : [':LspInfo' , 'lsp_info'], + \ 'l' : [':Lspsaga lsp_finder' , 'lsp_finder'], + \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], + \ 'o' : [':Vista!!' , 'outline'], + \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], + \ 'q' : [':Telescope quickfix' , 'quickfix'], + \ 'r' : [':LspRename' , 'rename'], + \ 'T' : [':LspTypeDefinition' , 'type defintion'], + \ 'x' : [':cclose' , 'close quickfix'], + \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], + \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], + \ } + +" t is for terminal +let g:which_key_map.t = { + \ 'name' : '+terminal' , + \ ';' : [':FloatermNew --wintype=normal --height=6' , 'terminal'], + \ 'f' : [':FloatermNew fzf' , 'fzf'], + \ 'g' : [':FloatermNew lazygit' , 'git'], + \ 'd' : [':FloatermNew lazydocker' , 'docker'], + \ 'n' : [':FloatermNew node' , 'node'], + \ 'N' : [':FloatermNew nnn' , 'nnn'], + \ 'p' : [':FloatermNew python' , 'python'], + \ 'm' : [':FloatermNew lazynpm' , 'npm'], + \ 'r' : [':FloatermNew ranger' , 'ranger'], + \ 't' : [':FloatermToggle' , 'toggle'], + \ 'y' : [':FloatermNew ytop' , 'ytop'], + \ 'u' : [':FloatermNew ncdu' , 'ncdu'], + \ } + +call which_key#register('<Space>', "g:which_key_map") |