From 2501edc0ea50a10f0c64e98ec6b00c69c07ccb40 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Mon, 19 Jul 2021 19:40:54 +0300 Subject: [PATCH] neovim: add zem-mode + symbol-outline --- home/.config/nvim/lua/mappings.lua | 45 +++++++++++--------- home/.config/nvim/lua/modules/statusline.lua | 2 +- home/.config/nvim/lua/modules/zen.lua | 20 +++++++++ home/.config/nvim/lua/options.lua | 2 +- home/.config/nvim/lua/plugins.lua | 23 +++++++++- 5 files changed, 67 insertions(+), 25 deletions(-) create mode 100644 home/.config/nvim/lua/modules/zen.lua diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index 180819e..abd44c8 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -123,8 +123,8 @@ wk.register({ name = 'Buffer', c = {':ColorizerToggle', 'Colorizer'}, d = {':bdelete', 'Close buffer'}, - f = {':NnnPicker %:p:h', 'File picker'}, - n = {':DashboardNewFile', 'New file'} + n = {':DashboardNewFile', 'New file'}, + z = {':ZenMode', 'Zen mode'} }, -- Telescope @@ -153,6 +153,26 @@ wk.register({ z = {':Telescope registers', 'Vim registers'} }, + -- Git + g = { + name = 'Git', + b = 'Blame current line', + p = 'Preview hunk', + r = 'Reset hunk', + R = 'Reset all hunks in buffer', + s = 'Stage hunk', + u = 'Undo hunk', + n = {':Neogit', 'Neogit'}, + f = { + name = 'Telescope', + a = {':Telescope git_stash', 'Stash'}, + b = {':Telescope git_bcommits', 'Buffer commits'}, + c = {':Telescope git_commits', 'Commits'}, + m = {':Telescope git_branches', 'Branches'}, + s = {':Telescope git_status', 'Status'} + } + }, + l = { name = 'LSP', a = 'Add workspace folder', @@ -177,6 +197,7 @@ wk.register({ s = {':Telescope lsp_document_symbols', 'Buffer symbols'}, S = {':Telescope lsp_workspace_symbols', 'Workspace symbols'} }, + g = {':SymbolsOutline', 'Symbol outline'}, D = {'TroubleToggle lsp_definitions', 'Definition list'}, E = {'TroubleToggle lsp_document_diagnostics', 'Document diagnostics list'}, W = {'TroubleToggle lsp_workspace_diagnostics', 'Workspace diagnostics list'}, @@ -184,25 +205,7 @@ wk.register({ Q = {'TroubleToggle quickfix', 'Quickfix list'} }, - -- Git - g = { - name = 'Git', - b = 'Blame current line', - p = 'Preview hunk', - r = 'Reset hunk', - R = 'Reset all hunks in buffer', - s = 'Stage hunk', - u = 'Undo hunk', - n = {':Neogit', 'Neogit'}, - f = { - name = 'Telescope', - a = {':Telescope git_stash', 'Stash'}, - b = {':Telescope git_bcommits', 'Buffer commits'}, - c = {':Telescope git_commits', 'Commits'}, - m = {':Telescope git_branches', 'Branches'}, - s = {':Telescope git_status', 'Status'} - } - }, + n = {':NnnPicker %:p:h', 'File picker'}, -- Tab related t = { diff --git a/home/.config/nvim/lua/modules/statusline.lua b/home/.config/nvim/lua/modules/statusline.lua index bb0a88c..3295748 100644 --- a/home/.config/nvim/lua/modules/statusline.lua +++ b/home/.config/nvim/lua/modules/statusline.lua @@ -2,7 +2,7 @@ local gl = require('galaxyline') local gls = gl.section local condition = require('galaxyline.condition') -gl.short_line_list = {'NvimTree', 'packer'} +gl.short_line_list = {'NvimTree', 'packer', 'Outline'} local colors = require('colors.' .. vim.g.global_theme).colors diff --git a/home/.config/nvim/lua/modules/zen.lua b/home/.config/nvim/lua/modules/zen.lua new file mode 100644 index 0000000..549f4e9 --- /dev/null +++ b/home/.config/nvim/lua/modules/zen.lua @@ -0,0 +1,20 @@ +return require('zen-mode').setup { + window = { + options = { + signcolumn = 'no', + number = false, + relativenumber = false, + cursorline = false, + cursorcolumn = false, + foldcolumn = '0' + } + }, + on_open = function(win) + vim.cmd('TSContextDisable') + vim.cmd('IndentBlanklineDisable') + end, + on_close = function() + vim.cmd('TSContextEnable') + -- vim.cmd('IndentBlanklineEnable') + end, +} diff --git a/home/.config/nvim/lua/options.lua b/home/.config/nvim/lua/options.lua index cbaaf1b..615e6dd 100644 --- a/home/.config/nvim/lua/options.lua +++ b/home/.config/nvim/lua/options.lua @@ -2,7 +2,7 @@ local opt = vim.opt local function load_options() vim.cmd('filetype indent plugin on') - vim.cmd('syntax enable') + vim.cmd('syntax on') -- vim.cmd('set iskeyword+=-') -- General settings diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index 51b65a7..94da71a 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -140,6 +140,16 @@ return require('packer').startup( require('modules.lsptrouble') end } + use { + 'simrat39/symbols-outline.nvim', + cmd = {'SymbolsOutline', 'SymbolsOutlineOpen'}, + setup = function() + vim.g.symbols_outline = { + highlight_hovered_item = false, + show_guides = false + } + end + } use { 'hrsh7th/nvim-compe', event = 'InsertEnter', @@ -302,6 +312,15 @@ return require('packer').startup( run = 'npm install --prefix server', cmd = 'Bracey' } + use { + 'folke/zen-mode.nvim', + cmd = 'ZenMode', + wants = 'twilight.nvim', + requires = {{'folke/twilight.nvim', opt = true}}, + config = function() + require('modules.zen') + end + } use { 'akinsho/nvim-toggleterm.lua', cmd = 'ToggleTerm', @@ -320,7 +339,7 @@ return require('packer').startup( end } - -- TODO: lspsaga, orgmode.nvim, zen-mode.nvim, nvim-lint, format(ter).nvim, rest.nvim, - -- sqls.nvim, symbols-outline.nvim, nvim-spectre, nvim-dap, dial.nvim, asynctasks.nvim + -- TODO: lspsaga, orgmode.nvim, nvim-lint, format(ter).nvim, rest.nvim, sqls.nvim, + -- nvim-spectre, nvim-dap, dial.nvim, asynctasks.nvim end )