diff --git a/init.lua b/init.lua index b7778f0..8af1bc3 100644 --- a/init.lua +++ b/init.lua @@ -31,7 +31,6 @@ end opt.guicursor:append('a:blinkon1000') -- Blink cursor once a second for all modes o.mouse = 'a' -- Enable mouse input o.termguicolors = true -- Enable 24bit terminal colors -g.neovide_confirm_quit = 1 -- Confirm closing neovide window when changes are unsaved -- Other interface settings o.clipboard = 'unnamedplus' -- Use system clipboard by default @@ -75,14 +74,20 @@ if fn.executable('rg') then end -- Convenience keybindings -require'which-key'.register{['!'] = {'copen', 'Quickfix window'}} -require'which-key'.register{[''] = {'set number! relativenumber!', 'Toggle relative numbers'}} -require'which-key'.register{[''] = {'set number!', 'Toggle line numbers'}} +do + -- which-key might not be available yet + local ok, which_key = pcall(require, 'which-key') + if ok then + which_key.register{['!'] = {'copen', 'Quickfix window'}} + which_key.register{[''] = {'set number! relativenumber!', 'Toggle relative numbers'}} + which_key.register{[''] = {'set number!', 'Toggle line numbers'}} -require'which-key'.register{[''] = {'h', 'Go to the left window'}} -require'which-key'.register{[''] = {'l', 'Go to the right window'}} -require'which-key'.register{[''] = {'n', 'Go to the up window'}} -require'which-key'.register{[''] = {'e', 'Go to the down window'}} + which_key.register{[''] = {'h', 'Go to the left window'}} + which_key.register{[''] = {'l', 'Go to the right window'}} + which_key.register{[''] = {'n', 'Go to the up window'}} + which_key.register{[''] = {'e', 'Go to the down window'}} + end +end -- Do workman remappings noremap('', 'n', 'gj') @@ -94,6 +99,9 @@ noremap('', 'k', 'e') vim.cmd [[ command! Light colorscheme base16-atelier-sulphurpool-light command! Dark colorscheme nord + +" Perform file as the root user +"cmap w!! w !sudo tee > /dev/null % ]] -- Autocommands @@ -110,32 +118,13 @@ au BufReadPost * " Highlight yanked text au TextYankPost * silent! lua vim.highlight.on_yank() -au User StartifyReady noremap n gj| noremap e gk +au User Startified noremap n j | noremap e k " Recompile plugin config cache when vimrc is updated au BufWritePost */.config/nvim/init.lua source | PackerCompile augroup END ]] ---local au = vim.api.nvim_create_augroup ---local augroup = vim.api.nvim_create_augroup('luarc', {clear = true}) ---au('User', { pattern = 'StartifyReady', group = augroup, callback = function(cmd) --- vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true}) --- vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true}) ---end}) ---au('BufWritePost', { --- pattern = '*/.config/nvim/init.lua', --- group = augroup, --- command = 'source | PackerCompile' ---}) ---au('TextYankPost', { pattern = '*', group = augroup, callback = vim.highlight.on_yank }) ---au('BufWritePost', { pattern = '*/.config/nvim/init.lua', command = 'source | PackerCompile' }) ---au('BufReadPost', { pattern = '*', group = augroup, command = function() --- local line = vim.fn.line --- if line[['\"]] > 1 && line[['\"]] <= line'$' && o.ft ~= 'commit' then --- vim.cmd'normal g`"' --- end ---end }) -- Diagnostics vim.diagnostic.config { @@ -237,21 +226,7 @@ require'packer'.startup(function(use) use 'vim-airline/vim-airline' use 'vim-airline/vim-airline-themes' use 'romgrk/barbar.nvim' - use {'MattesGroeger/vim-bookmarks', config = function() - vim.g.bookmark_save_per_working_dir = 1 - end} - use {'stevearc/dressing.nvim', config = function() - vim.cmd'highlight link FloatTitle TelescopeBorder' - require'dressing'.setup { - input = { - winhighlight = 'NormalFloat:TelescopeNormal,FloatBorder:TelescopeBorder' - }, - select = { - enabled = false, - telescope = require'telescope.themes'.get_cursor() - }, - } - end} + use 'MattesGroeger/vim-bookmarks' use 'j-hui/fidget.nvim' use 'tpope/vim-fugitive' use 'tpope/vim-rhubarb' @@ -274,7 +249,7 @@ require'packer'.startup(function(use) require'stabilize'.setup() end} use 'mhinz/vim-startify' - use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function() + use {'nvim-telescope/telescope.nvim', config = function() require'telescope'.setup { defaults = { sorting_strategy = 'ascending', @@ -302,7 +277,7 @@ require'packer'.startup(function(use) full_path = true, }, ['ui-select'] = { - require'telescope.themes'.get_cursor() + require'telescope.themes'.get_dropdown({layout_strategy = 'cursor'}) }, }, } @@ -310,7 +285,7 @@ require'packer'.startup(function(use) ["f"] = { name = 'Telescope', [""] = {'Telescope', 'List pickers'}, - f = {'Telescope find_files', 'Files'}, + f = {'Telescope find_files hidden=true', 'Files'}, d = {'Telescope find_files find_command=fd,--type,d,-I', 'Directories'}, r = {'Telescope oldfiles', 'Recent files'}, g = {'Telescope live_grep', 'Grep'}, @@ -350,7 +325,6 @@ require'packer'.startup(function(use) -- Finish bootstrap if we just cloned if packer_bootstrap then require('packer').sync() - vim.notify('Bootstrapped plugin manager, you may need to restart neovim') end end) @@ -726,11 +700,6 @@ require('nvim-tree').setup { } } vim.cmd'highlight NvimTreeOpenedFile guifg=NONE gui=italic' -vim.api.nvim_create_autocmd('ColorScheme', { - group = 'vimrc', - desc = 'Change NvimTreeOpenedFile highlight', - command = 'highlight NvimTreeOpenedFile guifg=NONE gui=italic' -}) require'which-key'.register{['t'] = {'NvimTreeToggle', 'Nvim Tree'}}