diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-05-01 14:26:11 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-05-01 14:26:11 +0200 |
commit | d2fc21ae088e0c078c39f7fb9f313b808e7e90b7 (patch) | |
tree | 443371c080af2a5ffca5c87799c0cd6f97948252 /.config/nvim | |
parent | 296b2245da8fda7c96080e96e238f97839e74411 (diff) |
Removed bloat, added some sweet features, synced with Lunarvim repo
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/init.lua | 3 | ||||
-rw-r--r-- | .config/nvim/language-settings.lua | 5 | ||||
-rw-r--r-- | .config/nvim/lua/_autocommands/init.lua | 8 | ||||
-rw-r--r-- | .config/nvim/lua/_comment/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/_compe/init.lua | 96 | ||||
-rw-r--r-- | .config/nvim/lua/_hop/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/_nvimtree/init.lua | 7 | ||||
-rw-r--r-- | .config/nvim/lua/_true-zen/init.lua | 67 | ||||
-rw-r--r-- | .config/nvim/lua/_vim-bbye/init.lua | 1 | ||||
-rw-r--r-- | .config/nvim/lua/_which-key/init.lua | 136 | ||||
-rw-r--r-- | .config/nvim/lua/mappings.lua | 42 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 9 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 8 | ||||
-rw-r--r-- | .config/nvim/vim-script/_whichkey/init.vim | 140 |
14 files changed, 317 insertions, 209 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 0ba8481..43a3b12 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -20,8 +20,9 @@ require('_rnvimr') require('_vim-rooter') require('_quickscope') require('_neogit') +require('_which-key') +require('_true-zen') -vim.cmd('source ~/.config/nvim/vim-script/_whichkey/init.vim') vim.cmd('source ~/.config/nvim/vim-script/functions.vim') -- LSP diff --git a/.config/nvim/language-settings.lua b/.config/nvim/language-settings.lua index 36a5d05..54e98b2 100644 --- a/.config/nvim/language-settings.lua +++ b/.config/nvim/language-settings.lua @@ -28,3 +28,8 @@ O.tsserver.autoformat = true -- json O.json.autoformat = true +O.json.formatter = 'prettier' + +-- sh +O.sh.linter = 'shellcheck' +O.sh.formatter = 'shfmt' diff --git a/.config/nvim/lua/_autocommands/init.lua b/.config/nvim/lua/_autocommands/init.lua index a94cb0f..1642127 100644 --- a/.config/nvim/lua/_autocommands/init.lua +++ b/.config/nvim/lua/_autocommands/init.lua @@ -7,9 +7,13 @@ if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} if O.tsserver.autoformat then table.insert(auto_formatters, javascript_autoformat) table.insert(auto_formatters, javascriptreact_autoformat) + table.insert(auto_formatters, typescript_autoformat) + table.insert(auto_formatters, typescriptreact_autoformat) end local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} @@ -20,7 +24,7 @@ if O.json.autoformat then table.insert(auto_formatters, json_format) end utils.define_augroups({ _general_settings = { - {'TextYankPost','*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, + {'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'}, @@ -51,4 +55,4 @@ utils.define_augroups({ {'FileType', 'floaterm', 'nnoremap <silent> <buffer> q :q<CR>'}, }, _auto_formatters = auto_formatters -}) +}) diff --git a/.config/nvim/lua/_comment/init.lua b/.config/nvim/lua/_comment/init.lua index 8d2ad52..e1f1358 100644 --- a/.config/nvim/lua/_comment/init.lua +++ b/.config/nvim/lua/_comment/init.lua @@ -1,3 +1 @@ require('nvim_comment').setup() -vim.api.nvim_set_keymap("n", "gc", ":CommentToggle<CR>", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("v", "gc", ":CommentToggle<CR>", {noremap=true, silent = true}) diff --git a/.config/nvim/lua/_compe/init.lua b/.config/nvim/lua/_compe/init.lua index 6127096..d386505 100644 --- a/.config/nvim/lua/_compe/init.lua +++ b/.config/nvim/lua/_compe/init.lua @@ -15,20 +15,20 @@ require'compe'.setup { documentation = true, source = { - path = {kind = " "}, - buffer = {kind = " "}, - calc = {kind = " "}, - vsnip = {kind = " "}, - nvim_lsp = {kind = " "}, + path = {kind = " (Path)"}, + buffer = {kind = " (Buffer)"}, + calc = {kind = " (Calc)"}, + vsnip = {kind = " (Snippet)"}, + nvim_lsp = {kind = " (LSP)"}, -- nvim_lua = {kind = " "}, nvim_lua = false, - spell = {kind = " "}, + spell = {kind = " (Spell)"}, tags = false, vim_dadbod_completion = true, -- snippets_nvim = {kind = " "}, -- ultisnips = {kind = " "}, -- treesitter = {kind = " "}, - emoji = {kind = " ﲃ ", filetypes={"markdown", "text"}} + emoji = {kind = " ﲃ (Emoji)", filetypes={"markdown", "text"}} -- for emoji press : (idk if that in compe tho) } } @@ -59,8 +59,56 @@ require'compe'.setup { -- -- +-- local t = function(str) +-- return vim.api.nvim_replace_termcodes(str, true, true, true) +-- end + +-- local check_back_space = function() +-- local col = vim.fn.col('.') - 1 +-- if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then +-- return true +-- else +-- return false +-- end +-- end + +-- -- Use (s-)tab to: +-- --- move to prev/next item in completion menuone +-- --- jump to prev/next snippet's placeholder +-- _G.tab_complete = function() +-- if vim.fn.pumvisible() == 1 then +-- return t "<C-n>" +-- elseif vim.fn.call("vsnip#available", {1}) == 1 then +-- return t "<Plug>(vsnip-expand-or-jump)" +-- elseif check_back_space() then +-- return t "<Tab>" +-- else +-- return vim.fn['compe#complete']() +-- end +-- end +-- _G.s_tab_complete = function() +-- if vim.fn.pumvisible() == 1 then +-- return t "<C-p>" +-- elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then +-- return t "<Plug>(vsnip-jump-prev)" +-- else +-- return t "<S-Tab>" +-- end +-- end + +-- vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) +-- vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) +-- vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) +-- vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) + + + + + + + local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) + return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() @@ -76,24 +124,24 @@ end --- move to prev/next item in completion menuone --- jump to prev/next snippet's placeholder _G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-n>" - elseif vim.fn.call("vsnip#available", {1}) == 1 then - return t "<Plug>(vsnip-expand-or-jump)" - elseif check_back_space() then - return t "<Tab>" - else - return vim.fn['compe#complete']() - end + if vim.fn.pumvisible() == 1 then + return t "<C-n>" + elseif vim.fn.call("vsnip#available", {1}) == 1 then + return t "<Plug>(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "<Tab>" + else + return vim.fn['compe#complete']() + end end _G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-p>" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "<Plug>(vsnip-jump-prev)" - else - return t "<S-Tab>" - end + if vim.fn.pumvisible() == 1 then + return t "<C-p>" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "<Plug>(vsnip-jump-prev)" + else + return t "<S-Tab>" + end end vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) diff --git a/.config/nvim/lua/_hop/init.lua b/.config/nvim/lua/_hop/init.lua deleted file mode 100644 index acd4cd7..0000000 --- a/.config/nvim/lua/_hop/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -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/_nvimtree/init.lua b/.config/nvim/lua/_nvimtree/init.lua index 11fe526..9f9cfd5 100644 --- a/.config/nvim/lua/_nvimtree/init.lua +++ b/.config/nvim/lua/_nvimtree/init.lua @@ -1,4 +1,5 @@ vim.g.nvim_tree_disable_netrw = 0 -- "1 by default, disables netrw +-- 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 vim.g.nvim_tree_follow = 1 -- "0 by default, this option allows the cursor to be updated when entering a buffer @@ -16,13 +17,13 @@ local tree_cb = require'nvim-tree.config'.nvim_tree_callback ["<2-LeftMouse>"] = tree_cb("edit"), ["<2-RightMouse>"] = tree_cb("cd"), ["<C-]>"] = tree_cb("cd"), - ["<C-v>"] = tree_cb("vsplit"), - ["<C-x>"] = tree_cb("split"), + ["v"] = tree_cb("vsplit"), + ["s"] = tree_cb("split"), ["<C-t>"] = tree_cb("tabnew"), ["<"] = tree_cb("prev_sibling"), [">"] = tree_cb("next_sibling"), ["<BS>"] = tree_cb("close_node"), - ["h"] = tree_cb("close_node"), + ["h"] = tree_cb("close_node"), ["<S-CR>"] = tree_cb("close_node"), ["<Tab>"] = tree_cb("preview"), ["I"] = tree_cb("toggle_ignored"), diff --git a/.config/nvim/lua/_true-zen/init.lua b/.config/nvim/lua/_true-zen/init.lua new file mode 100644 index 0000000..1abb9a0 --- /dev/null +++ b/.config/nvim/lua/_true-zen/init.lua @@ -0,0 +1,67 @@ +local true_zen = require("true-zen") + +-- setup for TrueZen.nvim +true_zen.setup({ + true_false_commands = false, + cursor_by_mode = false, + bottom = { + hidden_laststatus = 0, + hidden_ruler = false, + hidden_showmode = false, + hidden_showcmd = false, + hidden_cmdheight = 1, + + shown_laststatus = 2, + shown_ruler = true, + shown_showmode = false, + shown_showcmd = false, + shown_cmdheight = 1 + }, + top = { + hidden_showtabline = 0, + + shown_showtabline = 2 + }, + left = { + hidden_number = false, + hidden_relativenumber = false, + hidden_signcolumn = "no", + + shown_number = true, + shown_relativenumber = false, + shown_signcolumn = "no" + }, + 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 + }, + integrations = { + integration_galaxyline = true, + integration_vim_airline = false, + integration_vim_powerline = false, + integration_tmux = false, + integration_express_line = false, + integration_gitgutter = false, + integration_vim_signify = false, + integration_limelight = false, + integration_tzfocus_tzataraxis = false + } +}) diff --git a/.config/nvim/lua/_vim-bbye/init.lua b/.config/nvim/lua/_vim-bbye/init.lua deleted file mode 100644 index 77b4c39..0000000 --- a/.config/nvim/lua/_vim-bbye/init.lua +++ /dev/null @@ -1 +0,0 @@ -vim.api.nvim_set_keymap('n', '<Leader>q', ':Bdelete<CR>', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/_which-key/init.lua b/.config/nvim/lua/_which-key/init.lua new file mode 100644 index 0000000..65742b6 --- /dev/null +++ b/.config/nvim/lua/_which-key/init.lua @@ -0,0 +1,136 @@ +require("which-key").setup { + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode + -- 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 + 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 + g = true -- bindings for prefixed with g + } + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+" -- symbol prepended to a group + }, + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = {1, 0, 1, 0}, -- extra window margin [top, right, bottom, left] + padding = {2, 2, 2, 2} -- extra window padding [top, right, bottom, left] + }, + layout = { + height = {min = 4, max = 25}, -- min and max height of the columns + width = {min = 20, max = 50}, -- min and max width of the columns + spacing = 3 -- spacing between columns + }, + hidden = {"<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate + show_help = true -- show help message on the command line when the popup is visible +} + +local opts = { + mode = "n", -- NORMAL mode + prefix = "<leader>", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = false -- use `nowait` when creating keymaps +} + +-- Set leader +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}) + +-- telescope +vim.api.nvim_set_keymap('n', '<Leader>f', ':Telescope find_files<CR>', {noremap = true, silent = true}) + +-- dashboard +vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', {noremap = true, silent = true}) + +-- Comments +-- vim.api.nvim_set_keymap("n", "<leader>/", ":CommentToggle<CR>", {noremap = true, silent = true}) +-- vim.api.nvim_set_keymap("v", "<leader>/", ":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}) + +-- TODO create entire treesitter section + +local mappings = { + -- ["/"] = "Comment", + ["c"] = "Close Buffer", + ["z"] = "Zen Mode", + ["e"] = "Explorer", + ["f"] = "Find File", + ["h"] = "No Highlight", + d = { + name = "+Debug", + b = {"<cmd>DebugToggleBreakpoint<cr>", "Toggle Breakpoint"}, + c = {"<cmd>DebugContinue<cr>", "Continue"}, + i = {"<cmd>DebugStepInto<cr>", "Step Into"}, + o = {"<cmd>DebugStepOver<cr>", "Step Over"}, + r = {"<cmd>DebugToggleRepl<cr>", "Toggle Repl"}, + s = {"<cmd>DebugStart<cr>", "Start"} + }, + g = { + name = "+Git", + j = {"<cmd>NextHunk<cr>", "Next Hunk"}, + k = {"<cmd>PrevHunk<cr>", "Prev Hunk"}, + p = {"<cmd>PreviewHunk<cr>", "Preview Hunk"}, + r = {"<cmd>ResetHunk<cr>", "Reset Hunk"}, + R = {"<cmd>ResetBuffer<cr>", "Reset Buffer"}, + s = {"<cmd>StageHunk<cr>", "Stage Hunk"}, + u = {"<cmd>UndoStageHunk<cr>", "Undo Stage Hunk"} + }, + l = { + name = "+LSP", + a = {"<cmd>Lspsaga code_action<cr>", "Code Action"}, + A = {"<cmd>Lspsaga range_code_action<cr>", "Selected Action"}, + d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, + D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, + f = {"<cmd>LspFormatting<cr>", "Format"}, + i = {"<cmd>LspInfo<cr>", "Info"}, + l = {"<cmd>Lspsaga lsp_finder<cr>", "LSP Finder"}, + L = {"<cmd>Lspsaga show_line_diagnostics<cr>", "Line Diagnostics"}, + p = {"<cmd>Lspsaga preview_definition<cr>", "Preview Definition"}, + q = {"<cmd>Telescope quickfix<cr>", "Quickfix"}, + r = {"<cmd>Lspsaga rename<cr>", "Rename"}, + t = {"<cmd>LspTypeDefinition<cr>", "Type Definition"}, + x = {"<cmd>cclose<cr>", "Close Quickfix"}, + 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"}, + c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"}, + d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, + D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, + f = {"<cmd>Telescope find_files<cr>", "Find File"}, + m = {"<cmd>Telescope marks<cr>", "Marks"}, + M = {"<cmd>Telescope man_pages<cr>", "Man Pages"}, + r = {"<cmd>Telescope oldfiles<cr>", "Open Recent File"}, + 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"}} +} + +local wk = require("which-key") +wk.register(mappings, opts) diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 1233bf3..2e3eb7c 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -1,18 +1,10 @@ -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 }) - +vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<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 }) +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 @@ -37,30 +29,24 @@ vim.cmd([[ 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 }) +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 }) -vim.api.nvim_set_keymap('n', '<S-TAB>', ':bprevious<CR>', { noremap = true, silent = true }) +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 }) - +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/plugins.lua b/.config/nvim/lua/plugins.lua index 8663fc6..e580b55 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -74,6 +74,9 @@ return require("packer").startup( use {'akinsho/nvim-bufferline.lua', requires = 'kyazdani42/nvim-web-devicons'} use {"romgrk/barbar.nvim", opt = true} + -- Which key + use {"folke/which-key.nvim", opt = true} + -- Colorschemes use 'aktersnurra/githubsy.vim' use {"christianchiarulli/nvcode-color-schemes.vim", opt = true} @@ -87,10 +90,10 @@ return require("packer").startup( use 'tpope/vim-fugitive' use 'tpope/vim-rhubarb' - -- General Plugins + -- General Plugins [my own additions] use 'airblade/vim-rooter' use 'unblevable/quick-scope' - -- use 'junegunn/goyo.vim' + use 'kdav5758/TrueZen.nvim' -- use 'vimwiki/vimwiki' require_plugin("nvim-lspconfig") @@ -115,8 +118,10 @@ return require("packer").startup( require_plugin("nvim-web-devicons") require_plugin("galaxyline.nvim") require_plugin("barbar.nvim") + require_plugin("which-key.nvim") require_plugin("vim-rooter") require_plugin("quick-scope") + require_plugin("TrueZen") end ) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 4f06694..2cd1a40 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -8,14 +8,14 @@ vim.cmd('let &titleold="'..TERMINAL..'"') vim.o.titlestring="%<%F%=%l/%L - nvim" vim.wo.wrap = O.wrap_lines -- Display long lines as just one line vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys -vim.cmd('syntax on') -- move to next line with theses keys +vim.cmd('syntax on') -- syntax highlighting 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.splitbelow = true -- Horizontal splits will automatically be below -vim.o.termguicolors = true -- set term giu colors most terminals support this +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.conceallevel = 0 -- So that I can see `` in markdown files @@ -32,6 +32,6 @@ 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.timeoutlen = 500 -- By default timeoutlen is 1000 ms vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else -vim.o.guifont="SpaceMono\\ Nerd\\ Font\\ Mono:h18" +vim.o.guifont = "SpaceMono Nerd Font:h17" diff --git a/.config/nvim/vim-script/_whichkey/init.vim b/.config/nvim/vim-script/_whichkey/init.vim deleted file mode 100644 index eb52b82..0000000 --- a/.config/nvim/vim-script/_whichkey/init.vim +++ /dev/null @@ -1,140 +0,0 @@ -" Leader Key Maps - -" Timeout -let g:which_key_timeout = 100 - -let g:which_key_display_names = {'<CR>': '↵', '<TAB>': '⇆', " ": 'SPC'} - -" 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 - -" let g:which_key_map['/'] = 'comment toggle' -let g:which_key_map[';'] = [ ':Dashboard' , 'home screen' ] -let g:which_key_map['?'] = [ ':NvimTreeFindFile' , 'find current file' ] -let g:which_key_map['e'] = [ ':NvimTreeToggle' , 'explorer' ] -let g:which_key_map['f'] = [ ':Telescope find_files' , 'find files' ] -let g:which_key_map['h'] = [ '<C-W>s' , 'split below'] -let g:which_key_map['H'] = [ ':let @/ = ""' , 'no highlight' ] -let g:which_key_map['r'] = [ ':RnvimrToggle' , 'ranger' ] -" TODO create entire treesitter section -let g:which_key_map['v'] = [ '<C-W>v' , 'split right'] -" TODO play nice with status line - -" Group mappings - -" b is for buffer -let g:which_key_map.b = { - \ 'name' : '+buffer' , - \ '>' : [':BufferMoveNext' , 'move next'], - \ '<' : [':BufferMovePrevious' , 'move prev'], - \ 'b' : [':BufferPick' , 'pick buffer'], - \ 'd' : [':BufferClose' , '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' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'], - \ 'c' : ['DebugContinue' , 'continue'], - \ 'i' : ['DebugStepInto' , 'step into'], - \ 'o' : ['DebugStepOver' , 'step over'], - \ 'r' : ['DebugToggleRepl' , 'toggle repl'], - \ 's' : ['DebugStart' , 'start'], - \ } - -" 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'], - \ 'B' : [':Telescope git_branches' , 'git branches'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'], - \ 'f' : [':Telescope find_files' , 'files'], - \ 'h' : [':Telescope command_history' , 'history'], - \ 'i' : [':Telescope media_files' , 'media files'], - \ 'm' : [':Telescope marks' , 'marks'], - \ 'M' : [':Telescope man_pages' , 'man_pages'], - \ 'o' : [':Telescope vim_options' , 'vim_options'], - \ 't' : [':Telescope live_grep' , 'text'], - \ 'r' : [':Telescope registers' , 'registers'], - \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'], - \ 'u' : [':Telescope colorscheme' , 'colorschemes'], - \ } - -" S is for Session -let g:which_key_map.S = { - \ 'name' : '+Session' , - \ 's' : [':SessionSave' , 'save session'], - \ 'l' : [':SessionLoad' , 'load Session'], - \ } - -" g is for git -let g:which_key_map.g = { - \ 'name' : '+git' , - \ 'b' : [':GitBlameToggle' , 'blame'], - \ 'B' : [':GBrowse' , 'browse'], - \ 'd' : [':Git diff' , 'diff'], - \ 'j' : [':NextHunk' , 'next hunk'], - \ 'k' : [':PrevHunk' , 'prev hunk'], - \ 'l' : [':Git log' , 'log'], - \ 'p' : [':PreviewHunk' , 'preview hunk'], - \ 'r' : [':ResetHunk' , 'reset hunk'], - \ 'R' : [':ResetBuffer' , 'reset buffer'], - \ 's' : [':StageHunk' , 'stage hunk'], - \ 'S' : [':Gstatus' , 'status'], - \ 'u' : [':UndoStageHunk' , 'undo stage hunk'], - \ } - -" l is for language server protocol -let g:which_key_map.l = { - \ 'name' : '+lsp' , - \ 'a' : [':Lspsaga code_action' , 'code action'], - \ 'A' : [':Lspsaga range_code_action' , 'selected action'], - \ 'd' : [':Telescope lsp_document_diagnostics' , 'document diagnostics'], - \ 'D' : [':Telescope lsp_workspace_diagnostics', 'workspace diagnostics'], - \ 'f' : [':LspFormatting' , 'format'], - \ 'I' : [':LspInfo' , 'lsp info'], - \ 'v' : [':LspVirtualTextToggle' , 'lsp toggle virtual text'], - \ 'l' : [':Lspsaga lsp_finder' , 'lsp finder'], - \ 'L' : [':Lspsaga show_line_diagnostics' , 'line_diagnostics'], - \ 'p' : [':Lspsaga preview_definition' , 'preview definition'], - \ 'q' : [':Telescope quickfix' , 'quickfix'], - \ 'r' : [':Lspsaga rename' , 'rename'], - \ 'T' : [':LspTypeDefinition' , 'type defintion'], - \ 'x' : [':cclose' , 'close quickfix'], - \ 's' : [':Telescope lsp_document_symbols' , 'document symbols'], - \ 'S' : [':Telescope lsp_workspace_symbols' , 'workspace symbols'], - \ } - -call which_key#register('<Space>', "g:which_key_map") |