diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 7a41bb0e..a7167870 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,3 +1,4 @@ +-- local vim = vim require('plugins') require('keymaps') @@ -6,12 +7,21 @@ vim.api.nvim_exec([[ augroup Packer autocmd! autocmd BufWritePost init.lua PackerCompile + autocmd BufWritePost keymaps.lua PackerCompile autocmd BufWritePost plugins.lua PackerCompile augroup end ]], false) +vim.api.nvim_exec([[ +augroup AutoSaveGroup + autocmd! + autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview! + autocmd BufWinEnter ?* silent! loadview +augroup end +]], false) + vim.o.timeoutlen = 700 -vim.o.guifont='FiraCode Nerd Font Mono' +vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font' vim.o.undodir=vim.fn.stdpath('cache')..'/undodir' vim.o.undofile = true @@ -19,8 +29,13 @@ vim.o.undofile = true vim.o.showmode = false vim.o.showtabline = 2 vim.o.autoindent = true + vim.o.tabstop=4 +vim.o.softtabstop=4 + vim.o.shiftwidth=4 +vim.bo.shiftwidth=4 + vim.o.expandtab = true vim.o.hidden = true vim.o.ignorecase = true @@ -28,3 +43,20 @@ vim.o.smartcase = true vim.o.termguicolors = true -- No clue why window scoped vim.wo.signcolumn='yes' + +-- vim.o.modifiable = true +-- vim.bo.modifiable = true +vim.g.dashboard_default_executive = 'fzf' +vim.g.python_highlight_all = 1 + +vim.g.test = { + default = { + default = { + complete_items = { 'lsp', 'snippet' }, + mode = 'file', + }, + comment = {}, + string = { complete_items = { 'path' } }, + }, + rust = { { complete_items = {'ts'} } }, +} diff --git a/config/nvim/lua/keymaps.lua b/config/nvim/lua/keymaps.lua index 23c43469..c9e7f80e 100644 --- a/config/nvim/lua/keymaps.lua +++ b/config/nvim/lua/keymaps.lua @@ -15,34 +15,49 @@ local normal_mode_maps = { -- fzf { key = ';', map = [[Buffers]] }, - { key = 'f', map = [[Files]] }, + { key = 'ff', map = [[Files]] }, + { key = 'fb', map = [[Marks]] }, + { key = 'fh', map = [[History]] }, + { key = 'fa', map = [[History]] }, + + { key = 'tc', map = [[Colors]] }, { key = 'g', map = [[Rg]] }, + -- Session + { key = 'ss', map = [[SessionSave]] }, + { key = 'sl', map = [[SessionLoad]] }, + -- lsp { key = 'K', map = [[lua vim.lsp.buf.hover()]] }, - { key = 'gd', map = [[lua vim.lsp.buf.definition()]] }, + { key = '', map = [[lua vim.lsp.buf.definition()]] }, { key = 'gi', map = [[lua vim.lsp.buf.implementation()]] }, { key = 'o', map = [[LspTroubleToggle]] }, - { key = 'a', map = [[lua vim.lsp.buf.document_highlight()]] }, - { key = 'c', map = [[lua vim.lsp.buf.clear_references()]] }, + -- { key = 'a', map = [[lua vim.lsp.buf.document_highlight()]] }, + -- { key = 'c', map = [[lua vim.lsp.buf.clear_references()]] }, + { key = '"', map = [["+]] }, { key = 'F', map = [[lua vim.lsp.buf.formatting()]] }, + { key = 'T', map = [[lua require'lsp_extensions'.inlay_hints()]] }, -- Other { key = 'm', map = [[silent !mpcfzf]] }, } -local insert_mode_maps = { - { - key = '', - map = [[pumvisible() ? "\" : "\"]], - options = { noremap = true, silent = true, expr = true } - }, - { - key = '', - map = [[pumvisible() ? "\" : "\"]], - options = { noremap = true, silent = true, expr = true } - }, +vim.api.nvim_command([[imap (completion_smart_tab)]]) +vim.api.nvim_command([[imap (completion_smart_s_tab)]]) + +local insert_mode_maps = { + -- { + -- key = '', + -- map = [[pumvisible() ? "\" : "\"]], + -- options = { noremap = true, silent = true, expr = true } + -- }, + + -- { + -- key = '', + -- map = [[pumvisible() ? "\" : "\"]], + -- options = { noremap = true, silent = true, expr = true } + -- }, -- { key = '', map = '(completion_smart_tab)', options = { plug = true } }, -- { key = '', map = '(completion_smart_s_tab)', options = { plug = true } }, @@ -55,10 +70,10 @@ for idx = 1, #normal_mode_maps do if normal_mode_maps[idx].options then local options = normal_mode_maps[idx].options vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options) - else + else vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options) end -end +end for idx = 1, #insert_mode_maps do if insert_mode_maps[idx].options then @@ -67,4 +82,13 @@ for idx = 1, #insert_mode_maps do else vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options) end -end +end + + + + +-- local ff = { +-- { 'this', 'and this' }, +-- { 'that', 'and that' }, +-- } +-- print(ff[1][2]) diff --git a/config/nvim/lua/lsp/init.lua b/config/nvim/lua/lsp/init.lua index 2a51fa38..e78d084d 100644 --- a/config/nvim/lua/lsp/init.lua +++ b/config/nvim/lua/lsp/init.lua @@ -3,6 +3,7 @@ require("lsp.rust-analyzer") require("lsp.lua-language-server") +require("lsp.pyls") -- Set completeopt to have a better completion experience vim.o.completeopt= "menuone,noinsert,noselect" diff --git a/config/nvim/lua/lsp/pyls.lua b/config/nvim/lua/lsp/pyls.lua new file mode 100644 index 00000000..c32632f2 --- /dev/null +++ b/config/nvim/lua/lsp/pyls.lua @@ -0,0 +1,6 @@ +local lspconfig = require'lspconfig' + +lspconfig.pyls.setup{ + cmd = { "pyls" }, + filetypes = { "python" }, +} diff --git a/config/nvim/lua/lsp/rust-analyzer.lua b/config/nvim/lua/lsp/rust-analyzer.lua index fef5cd9e..5992bfa0 100644 --- a/config/nvim/lua/lsp/rust-analyzer.lua +++ b/config/nvim/lua/lsp/rust-analyzer.lua @@ -11,10 +11,11 @@ lspconfig.rust_analyzer.setup{ settings = { ["rust-analyzer"] = { checkOnSave = { - command = "clippy"; + command = "clippy", }, cargo = { - allFeatures = true; + allFeatures = true, + -- target = "aarch64-linux-android" } } } diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index eaadb070..783c2f09 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -1,3 +1,4 @@ +local vim = vim local execute = vim.api.nvim_command local fn = vim.fn @@ -44,30 +45,41 @@ return require('packer').startup(function() 'tpope/vim-commentary', 'tpope/vim-fugitive', } + use { 'norcalli/nvim-colorizer.lua', config = function() require'colorizer'.setup() end, } -- lsp use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, } - use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup {} end, } + use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, } use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } use { 'nvim-lua/completion-nvim' } use { 'nvim-lua/lsp-status.nvim' } - use { - 'nvim-lua/lsp_extensions.nvim', - config = - function() - vim.api.nvim_command([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints{}]]) - end + -- use { 'folke/lsp-colors.nvim' } + use { 'nvim-lua/lsp_extensions.nvim' } + -- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end, + -- + -- Qol + use { 'sindrets/diffview.nvim' } + use { 'justinmk/vim-sneak' } + use { + 'akinsho/nvim-toggleterm.lua', + config = function() require'setup.toggleterm' end, } - use { 'airblade/vim-rooter' } + use { 'glepnir/dashboard-nvim' } - -- rust {{{ + -- Treesitter {{{ + use { 'nvim-treesitter/nvim-treesitter' } + use { 'nvim-treesitter/completion-treesitter' } + --- }}} + + --: rust {{{ use { 'rust-lang/rust.vim', 'mhinz/vim-crates', - 'cespare/vim-toml', + 'cespare/vim-toml', } -- }}} + use { 'vim-python/python-syntax' } end) diff --git a/config/nvim/lua/setup/toggleterm.lua b/config/nvim/lua/setup/toggleterm.lua new file mode 100644 index 00000000..c6c590e0 --- /dev/null +++ b/config/nvim/lua/setup/toggleterm.lua @@ -0,0 +1,31 @@ +require("toggleterm").setup{ + size = 70, + open_mapping = [[]], + hide_numbers = true, -- hide the number column in toggleterm buffers + shade_filetypes = {}, + shade_terminals = true, + shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light + start_in_insert = true, + persist_size = true, + -- direction = 'vertical' | 'horizontal' | 'window' | 'float', + direction = 'vertical', + close_on_exit = true, -- close the terminal window when the process exits + shell = vim.o.shell, -- change the default shell + -- This field is only relevant if direction is set to 'float' + float_opts = { + -- The border key is *almost* the same as 'nvim_win_open' + -- see :h nvim_win_open for details on borders however + -- the 'curved' border is a custom border type + -- not natively supported but implemented in this plugin. + + -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open + border = 'single', + width = 30, + height = 30, + winblend = 3, + highlights = { + border = "Normal", + background = "Normal", + } + } +} diff --git a/config/nvim/lua/statusline.lua b/config/nvim/lua/statusline.lua index cadbc40b..f119e2d7 100644 --- a/config/nvim/lua/statusline.lua +++ b/config/nvim/lua/statusline.lua @@ -3,7 +3,7 @@ local gl = require('galaxyline') local condition = require('galaxyline.condition') -- local diagnostic = require('galaxyline.provider_diagnostic') -local diagnostics = require('lsp-status.diagnostics') +-- local diagnostics = require('lsp-status.diagnostics') local vcs = require('galaxyline.provider_vcs') local fileinfo = require('galaxyline.provider_fileinfo') -- local extension = require('galaxyline.provider_extensions') @@ -36,12 +36,13 @@ local colors = { bg_blue = '#85d3f2', diff_blue = '#354157', + yellow = '#e7c664', diff_yellow = '#4e432f', + fg = '#e2e2e3', red = '#fc5d7c', orange = '#f39660', - yellow = '#e7c664', green = '#9ed072', blue = '#76cce0', purple = '#b39df3', @@ -107,14 +108,6 @@ gls.left[1] = { } } --- gls.left[2] = { --- GitIcon = { --- provider = function() return '  ' end, --- condition = condition.check_git_workspace, --- highlight = { colors.purple , colors.bg1 }, --- } --- } - gls.left[2] = { GitBranch = { provider = function() return vcs.get_git_branch()..' ' end, @@ -129,15 +122,7 @@ gls.left[2] = { gls.left[3] = { ShowLspStatus = { provider = lspstatus.status, - -- condition = function () - -- local tbl = {['dashboard'] = true,['']=true} - -- if tbl[vim.bo.filetype] then - -- return false - -- end - -- return true - -- end, - -- icon = '  LSP:', - highlight = { colors.diff_yellow , colors.dark_black, 'bold' } + highlight = { colors.grey , colors.dark_black, 'bold' } } }