diff options
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/init.lua | 7 | ||||
| -rw-r--r-- | .config/nvim/lua/autocomplete.lua | 131 | ||||
| -rw-r--r-- | .config/nvim/lua/fzf.lua | 4 | ||||
| -rw-r--r-- | .config/nvim/lua/git.lua | 43 | ||||
| -rw-r--r-- | .config/nvim/lua/highlighting.lua | 88 | ||||
| -rw-r--r-- | .config/nvim/lua/ls.lua | 69 | ||||
| -rw-r--r-- | .config/nvim/lua/lsp.lua | 73 | ||||
| -rw-r--r-- | .config/nvim/lua/lspsaga_conf.lua | 19 | ||||
| -rw-r--r-- | .config/nvim/lua/mappings.lua | 38 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins.lua | 100 | ||||
| -rw-r--r-- | .config/nvim/lua/powerline.lua | 32 | ||||
| -rw-r--r-- | .config/nvim/lua/settings.lua | 106 | ||||
| -rw-r--r-- | .config/nvim/lua/treesitter.lua | 34 |
13 files changed, 465 insertions, 279 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index d1440f9..e69c430 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,11 +3,10 @@ require('settings') require('mappings') require('fzf') require('lsp') +require('lspsaga_conf') require('treesitter') require('highlighting') require('autocomplete') require('powerline') - - --- plugins -require('neoscroll').setup() +require('git') +require('ls') diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index a86e86b..62cee98 100644 --- a/.config/nvim/lua/autocomplete.lua +++ b/.config/nvim/lua/autocomplete.lua @@ -1,35 +1,41 @@ - -- Set up nvim-cmp. - local cmp = require'cmp' +-- Set up nvim-cmp. +local cmp = require 'cmp' - cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - ['<C-b>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.abort(), - ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - ["<Tab>"] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then - feedkey("<C-n>", "n") - elseif cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { +-- https://old.reddit.com/r/neovim/comments/ucze6k/q_any_idea_why_i_cannot_do_tab_completion_on/i6eomr5/ +vim.keymap.set('c', '<tab>', '<C-z>', { silent = false }) + +cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + experimental = { + ghost_text = true, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ["<Tab>"] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + feedkey("<C-n>", "n") + elseif cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", }), ["<S-Tab>"] = cmp.mapping(function(fallback) @@ -43,39 +49,40 @@ end, { "i", }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - }) + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, }) +}) - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = 'buffer' }, - }) +-- Set configuration for specific filetype. +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. + }, { + { name = 'buffer' }, }) +}) - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }) +}) diff --git a/.config/nvim/lua/fzf.lua b/.config/nvim/lua/fzf.lua index 1447438..aa016a1 100644 --- a/.config/nvim/lua/fzf.lua +++ b/.config/nvim/lua/fzf.lua @@ -1,10 +1,6 @@ - local fzf = require('fzf-lua') vim.keymap.set('n', '<leader>ff', fzf.files, {}) vim.keymap.set('n', '<leader>fg', fzf.live_grep, {}) vim.keymap.set('n', '<leader>fw', fzf.grep_cword, {}) vim.keymap.set('n', '<leader>fW', fzf.grep_cWORD, {}) vim.keymap.set('v', '<leader>ff', fzf.grep_visual, {}) - - - diff --git a/.config/nvim/lua/git.lua b/.config/nvim/lua/git.lua new file mode 100644 index 0000000..06fd5be --- /dev/null +++ b/.config/nvim/lua/git.lua @@ -0,0 +1,43 @@ +require('gitsigns').setup { + signs = { + add = { text = '│' }, + change = { text = '│' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = true, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + auto_attach = true, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, +} diff --git a/.config/nvim/lua/highlighting.lua b/.config/nvim/lua/highlighting.lua index 9c4332d..1c4a71b 100644 --- a/.config/nvim/lua/highlighting.lua +++ b/.config/nvim/lua/highlighting.lua @@ -1,47 +1,47 @@ -- default configuration require('illuminate').configure({ - -- providers: provider used to get references in the buffer, ordered by priority - providers = { - 'lsp', - 'treesitter', - 'regex', - }, - -- delay: delay in milliseconds - delay = 100, - -- filetype_overrides: filetype specific overrides. - -- The keys are strings to represent the filetype while the values are tables that - -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist - filetype_overrides = {}, - -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist - filetypes_denylist = { - 'dirvish', - 'fugitive', - }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist - filetypes_allowlist = {}, - -- modes_denylist: modes to not illuminate, this overrides modes_allowlist - -- See `:help mode()` for possible values - modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist - -- See `:help mode()` for possible values - modes_allowlist = {}, - -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_allowlist = {}, - -- under_cursor: whether or not to illuminate under the cursor - under_cursor = true, - -- large_file_cutoff: number of lines at which to use large_file_config - -- The `under_cursor` option is disabled when this cutoff is hit - large_file_cutoff = nil, - -- large_file_config: config to use for large files (based on large_file_cutoff). - -- Supports the same keys passed to .configure - -- If nil, vim-illuminate will be disabled for large files. - large_file_overrides = nil, - -- min_count_to_highlight: minimum number of matches required to perform highlighting - min_count_to_highlight = 1, + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + -- delay: delay in milliseconds + delay = 100, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + 'dirvish', + 'fugitive', + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + -- See `:help mode()` for possible values + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + -- See `:help mode()` for possible values + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + -- large_file_cutoff: number of lines at which to use large_file_config + -- The `under_cursor` option is disabled when this cutoff is hit + large_file_cutoff = nil, + -- large_file_config: config to use for large files (based on large_file_cutoff). + -- Supports the same keys passed to .configure + -- If nil, vim-illuminate will be disabled for large files. + large_file_overrides = nil, + -- min_count_to_highlight: minimum number of matches required to perform highlighting + min_count_to_highlight = 1, }) diff --git a/.config/nvim/lua/ls.lua b/.config/nvim/lua/ls.lua new file mode 100644 index 0000000..5484611 --- /dev/null +++ b/.config/nvim/lua/ls.lua @@ -0,0 +1,69 @@ +require 'jabs'.setup { + -- Options for the main window + position = { 'right', 'bottom' }, -- position = {'<position_x>', '<position_y>'} | <position_x> left, center, right, + -- <position_y> top, center, bottom + -- Default {'right', 'bottom'} + + relative = 'win', -- win, editor, cursor. Default win + clip_popup_size = true, -- clips the popup size to the win (or editor) size. Default true + + width = 50, -- default 50 + height = 10, -- default 10 + border = 'shadow', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default shadow + + offset = { -- window position offset + top = 2, -- default 0 + bottom = 2, -- default 0 + left = 2, -- default 0 + right = 2, -- default 0 + }, + + sort_mru = true, -- Sort buffers by most recently used (true or false). Default false + split_filename = false, -- Split filename into separate components for name and path. Default false + split_filename_path_width = 20, -- If split_filename is true, how wide the column for the path is supposed to be, Default 0 (don't show path) + + -- Options for preview window + preview_position = 'top', -- top, bottom, left, right. Default top + preview = { + width = 70, -- default 70 + height = 30, -- default 30 + border = 'double', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default double + }, + + -- Default highlights (must be a valid :highlight) + highlight = { + current = "Title", -- default StatusLine + hidden = "StatusLineNC", -- default ModeMsg + split = "WarningMsg", -- default StatusLine + alternate = "StatusLine" -- default WarningMsg + }, + + -- Default symbols + symbols = { + current = "C", -- default ]] + split = "S", -- default ]] + alternate = "A", -- default ]] + hidden = "H", -- default ]] + locked = "L", -- default ]] + ro = "R", -- default ]] + edited = "E", -- default ]] + terminal = "T", -- default ]] + default_file = "D", -- Filetype icon if not present in nvim-web-devicons. Default ]] + terminal_symbol = ">_" -- Filetype icon for a terminal split. Default ]] + }, + + -- Keymaps + keymap = { + close = "<c-d>", -- Close buffer. Default D + jump = "<cr>", -- Jump to buffer. Default <cr> + h_split = "h", -- Horizontally split buffer. Default s + v_split = "v", -- Vertically split buffer. Default v + preview = "p", -- Open buffer preview. Default P + }, + + -- Whether to use nvim-web-devicons next to filenames + use_devicons = true -- true or false. Default true +} + + +Nmap('<c-f>', ':JABSOpen<CR>') diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 1cbfb5e..632c355 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,5 +1,5 @@ -- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap=true, silent=true } +local opts = { noremap = true, silent = true } vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) @@ -11,18 +11,17 @@ vim.lsp.set_log_level("debug") -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) -- Enable completion triggered by <c-x><c-o> - vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc") + vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc") -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap=true, silent=true, buffer=bufnr } + local bufopts = { noremap = true, silent = true, buffer = bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) vim.keymap.set('n', '<space>wl', function() @@ -40,9 +39,9 @@ end local capabilities = require("cmp_nvim_lsp").default_capabilities() -- Setup rust_analyzer via rust-tools.nvim require("rust-tools").setup({ - server = { - capabilities = capabilities, - on_attach = on_attach, + server = { + capabilities = capabilities, + on_attach = on_attach, settings = { ['rust-analyzer'] = { cargo = { @@ -50,7 +49,7 @@ require("rust-tools").setup({ } } } - } + } }) -- https://github.com/ray-x/go.nvim#lsp-cmp-support @@ -80,7 +79,7 @@ lspconfig['dotls'].setup({ }) -lspconfig.yamlls.setup{ +lspconfig.yamlls.setup { settings = { yaml = { -- FIX mapKeyOrder warning @@ -89,11 +88,59 @@ lspconfig.yamlls.setup{ } } +lspconfig.lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + on_init = function(client) + local path = client.workspace_folders[1].name + if not vim.loop.fs_stat(path .. '/.luarc.json') and not vim.loop.fs_stat(path .. '/.luarc.jsonc') then + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + } + }) + + client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) + end + return true + end +} + +lspconfig.sqls.setup { + on_attach = function(client, bufnr) + require('sqls').on_attach(client, bufnr) + end, + sqls = { + connections = { + { + driver = 'sqlite3', + dataSourceName = '/home/algo/test.sqlite3', + }, + }, + }, +} + -- close quickfix menu after selecting choice vim.api.nvim_create_autocmd( "FileType", { - pattern={"qf"}, - command=[[nnoremap <buffer> <CR> <CR>:cclose<CR>]]}) + pattern = { "qf" }, + command = [[nnoremap <buffer> <CR> <CR>:cclose<CR>]] + }) vim.api.nvim_create_autocmd('BufWritePre', { pattern = '*.go', diff --git a/.config/nvim/lua/lspsaga_conf.lua b/.config/nvim/lua/lspsaga_conf.lua new file mode 100644 index 0000000..dabd040 --- /dev/null +++ b/.config/nvim/lua/lspsaga_conf.lua @@ -0,0 +1,19 @@ +vim.g.matchup_matchparen_offscreen = { method = {} } + +require('lspsaga').setup({ + outline = { + win_position = 'right', + auto_preview = true, + detail = true, + auto_close = true, + close_after_jump = true, + layout = 'float', + keys = { + toggle_or_jump = '<cr>', + quit = 'q', + jump = 'e', + }, + }, +}) + +Nmap('<c-d>', ':Lspsaga outline<CR>') diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 549573a..1421ea8 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -1,38 +1,32 @@ -- https://github.com/arnvald/viml-to-lua/blob/main/lua/mappings.lua vim.cmd('noremap <C-b> :noh<cr>:call clearmatches()<cr>') -- clear matches Ctrl+b -function map(mode, shortcut, command) +function Map(mode, shortcut, command) vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) end -function nmap(shortcut, command) - map('n', shortcut, command) +function Nmap(shortcut, command) + Map('n', shortcut, command) end -function imap(shortcut, command) - map('i', shortcut, command) +function Imap(shortcut, command) + Map('i', shortcut, command) end -function vmap(shortcut, command) - map('v', shortcut, command) +function Vmap(shortcut, command) + Map('v', shortcut, command) end -function cmap(shortcut, command) - map('c', shortcut, command) +function Cmap(shortcut, command) + Map('c', shortcut, command) end -function tmap(shortcut, command) - map('t', shortcut, command) +function Tmap(shortcut, command) + Map('t', shortcut, command) end - --- PLUGINS ---local builtin = require('telescope.builtin') ---vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) ---vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) ---vim.api.nvim_set_keymap( 'n', '<leader>fw', '<cmd>lua require(\'telescope.builtin\').grep_string({search = vim.fn.expand("<cword>")})<cr>', {}) ---vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) ---vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) - - - +--- pane nav +Nmap("<c-k>", ":wincmd k<CR>") +Nmap("<c-j>", ":wincmd j<CR>") +Nmap("<c-h>", ":wincmd h<CR>") +Nmap("<c-l>", ":wincmd l<CR>") diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 5a11126..1c5c2ad 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -4,52 +4,45 @@ return require('packer').startup(function() use 'wbthomason/packer.nvim' use 'morhetz/gruvbox' - use 'karb94/neoscroll.nvim' use 'edkolev/tmuxline.vim' use 'romainl/vim-cool' - use 'lambdalisue/suda.vim' - -- common use 'tpope/vim-fugitive' -- Git commands use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } } - use 'rhysd/vim-grammarous' -- grammar check use 'andymass/vim-matchup' -- matching parens and more - use 'rhysd/git-messenger.vim' + use 'lewis6991/gitsigns.nvim' - use 'luochen1990/rainbow' use 'RRethy/vim-illuminate' -- better quickfix buffer - use {'kevinhwang91/nvim-bqf', - ft = 'qf', - config = function() - require("bqf").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - } - end + use { 'kevinhwang91/nvim-bqf', + ft = 'qf', + config = function() + require('bqf').setup { + -- your configuration comes here + -- or leave it empty to use the default settings + } + end } + use 'matbme/JABS.nvim' -- buffer switcher -- general dev use 'neovim/nvim-lspconfig' - use 'kabouzeid/nvim-lspinstall' use({ "glepnir/lspsaga.nvim", branch = "main", - config = function() - require("lspsaga").setup({}) - end, requires = { - {"nvim-tree/nvim-web-devicons"}, - --Please make sure you install markdown and markdown_inline parser - {"nvim-treesitter/nvim-treesitter"} + { "nvim-tree/nvim-web-devicons" }, + --Please make sure you install markdown and markdown_inline parser + { "nvim-treesitter/nvim-treesitter" } } -}) + }) + use 'hrsh7th/nvim-cmp' use 'hrsh7th/cmp-buffer' use 'hrsh7th/cmp-nvim-lua' @@ -62,22 +55,34 @@ return require('packer').startup(function() use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } use 'scrooloose/nerdcommenter' -- commenting shortcuts use { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - require("which-key").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - } - end -} + "folke/which-key.nvim", + config = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + require("which-key").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + } + end + } - -- search - use { 'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} } - use 'tpope/vim-eunuch' -- wrappers UNIX commands + use 'tpope/vim-eunuch' -- wrappers UNIX commands use 'tpope/vim-surround' -- surround characters shortcuts - use 'tpope/vim-vinegar' -- file browser + use 'tpope/vim-vinegar' -- make explore better + use 'tpope/vim-endwise' -- wisely add + use 'tpope/vim-repeat' -- repeat for plugins + use { + 'prichrd/netrw.nvim', -- particles for ^ + config = function() + require("netrw").setup { + directory = '', -- Directory icon + file = '', -- File icon + use_devicons = true, -- Uses nvim-web-devicons if true, otherwise use the file icon specified above + mappings = {}, -- Custom key mappings + } + end + } + use 'kyazdani42/nvim-web-devicons' -- icons when searching use { "ibhagwan/fzf-lua", -- optional for icon support @@ -108,8 +113,19 @@ return require('packer').startup(function() use 'wsdjeg/vim-fetch' use { "johmsalas/text-case.nvim", - config = function() - require('textcase').setup {} - end -} + config = function() + require('textcase').setup {} + end + } + + -- integer base conversions + use { + "glts/vim-radical", + requires = { + { "glts/vim-magnum" }, + } + } + + use 'tpope/vim-dadbod' -- SQL + use 'nanotee/sqls.nvim' end) diff --git a/.config/nvim/lua/powerline.lua b/.config/nvim/lua/powerline.lua index e7b41b5..f7394e2 100644 --- a/.config/nvim/lua/powerline.lua +++ b/.config/nvim/lua/powerline.lua @@ -2,8 +2,8 @@ require('lualine').setup { options = { icons_enabled = true, theme = 'gruvbox_dark', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, disabled_filetypes = { statusline = {}, winbar = {}, @@ -18,28 +18,28 @@ require('lualine').setup { } }, sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {{'filename', path=1}}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { { 'filename', path = 1 } }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } }, inactive_sections = { lualine_a = {}, lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, lualine_y = {}, lualine_z = {} }, tabline = { - lualine_a = {'buffers'}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {'tabs'} + lualine_a = { 'buffers' }, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = { 'tabs' } }, winbar = {}, inactive_winbar = {}, diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index dab30f7..837f22a 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -3,72 +3,73 @@ vim.cmd([[ filetype plugin indent on ]]) -HOME = os.getenv("HOME") +HOME = os.getenv("HOME") -vim.g.mapleader = ' ' +vim.g.mapleader = ' ' -vim.wo.cursorline = true +vim.wo.cursorline = true vim.opt.termguicolors = true -- basic settings -vim.o.encoding = "utf-8" -vim.o.backspace = "indent,eol,start" -- backspace works on every char in insert mode -vim.o.completeopt = 'menuone,noselect' -vim.o.history = 1000 -vim.o.dictionary = '/usr/share/dict/words' -vim.o.startofline = true +vim.o.encoding = "utf-8" +vim.o.backspace = "indent,eol,start" -- backspace works on every char in insert mode +vim.o.completeopt = 'menuone,noselect' +vim.o.history = 1000 +vim.o.dictionary = '/usr/share/dict/words' +vim.o.startofline = true -- Mapping waiting time -vim.o.timeout = false -vim.o.ttimeout = true -vim.o.ttimeoutlen = 100 +vim.o.timeout = false +vim.o.ttimeout = true +vim.o.ttimeoutlen = 100 -- Display -vim.o.showmatch = true -- show matching brackets -vim.o.scrolloff = 3 -- always show 3 rows from edge of the screen -vim.o.synmaxcol = 300 -- stop syntax highlight after x lines for performance -vim.o.laststatus = 2 -- always show status line +vim.o.showmatch = true -- show matching brackets +vim.o.scrolloff = 3 -- always show 3 rows from edge of the screen +vim.o.synmaxcol = 300 -- stop syntax highlight after x lines for performance +vim.o.laststatus = 2 -- always show status line -vim.o.list = false -- do not display white characters -vim.o.foldenable = false -vim.o.foldlevel = 4 -- limit folding to 4 levels -vim.o.foldmethod = 'syntax' -- use language syntax to generate folds -vim.o.wrap = true --do not wrap lines even if very long -vim.o.eol = true -- show if there's no eol char -vim.o.showbreak= '↪' -- character to show when line is broken +vim.o.list = false -- do not display white characters +vim.o.foldenable = false +vim.o.foldlevel = 4 -- limit folding to 4 levels +vim.o.foldmethod = 'syntax' -- use language syntax to generate folds +vim.o.wrap = true --do not wrap lines even if very long +vim.o.eol = true -- show if there's no eol char +vim.o.showbreak = '↪' -- character to show when line is broken -vim.opt.clipboard = 'unnamedplus' +vim.opt.clipboard = 'unnamedplus' -- Sidebar -vim.o.number = true -- line number on the left -vim.o.numberwidth = 3 -- always reserve 3 spaces for line number -vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check -vim.o.modelines = 0 -vim.o.showcmd = true -- display command in bottom bar +vim.o.number = true -- line number on the left +vim.o.numberwidth = 3 -- always reserve 3 spaces for line number +vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check +vim.o.modelines = 0 +vim.o.showcmd = true -- display command in bottom bar -- Search -vim.o.incsearch = true -- starts searching as soon as typing, without enter needed -vim.o.ignorecase = true -- ignore letter case when searching -vim.o.smartcase = true -- case insentive unless capitals used in search +vim.o.incsearch = true -- starts searching as soon as typing, without enter needed +vim.o.ignorecase = true -- ignore letter case when searching +vim.o.smartcase = true -- case insentive unless capitals used in search -vim.o.matchtime = 2 -- delay before showing matching paren -vim.o.mps = vim.o.mps .. ",<:>" +vim.o.matchtime = 2 -- delay before showing matching paren +vim.o.mps = vim.o.mps .. ",<:>" -- White characters -vim.o.autoindent = true -vim.o.smartindent = true -vim.o.tabstop = 2 -- 1 tab = 2 spaces -vim.o.shiftwidth = 2 -- indentation rule -vim.o.formatoptions = 'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word -vim.o.expandtab = true -- expand tab to spaces +vim.o.autoindent = true +vim.o.smartindent = true +vim.o.tabstop = 2 -- 1 tab = 2 spaces +vim.o.shiftwidth = 2 -- indentation rule +vim.o.formatoptions = +'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word +vim.o.expandtab = true -- expand tab to spaces -- Backup files -vim.o.backup = true -- use backup files -vim.o.writebackup = false -vim.o.swapfile = false -- do not use swap file -vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files -vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups -vim.o.directory = '/.vim/tmp/swap//' -- swap files +vim.o.backup = true -- use backup files +vim.o.writebackup = false +vim.o.swapfile = false -- do not use swap file +vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files +vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups +vim.o.directory = '/.vim/tmp/swap//' -- swap files vim.cmd([[ au FileType python set ts=4 sw=4 @@ -78,6 +79,7 @@ vim.cmd([[ au BufRead,BufNewFile *.slimbars set syntax=slim ]]) + vim.cmd('colorscheme gruvbox') vim.cmd([[ " ### Transparency ### @@ -93,13 +95,23 @@ hi EndOfBuffer guibg=none ctermbg=none -- Commands mode vim.o.wildmenu = true -- on TAB, complete options for system command -vim.o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' +vim.o.wildignore = +'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' + -- rust format on save -- https://sharksforarms.dev/posts/neovim-rust/ local format_sync_grp = vim.api.nvim_create_augroup("Format", {}) vim.api.nvim_create_autocmd("BufWritePre", { + pattern = { "*" }, callback = function() + print(vim.bo.filetype) + -- idk what's happening but: + -- https://github.com/sqls-server/sqls/issues/105 + if vim.bo.filetype == 'sql' then + return + end + vim.lsp.buf.format({ timeout_ms = 200 }) end, group = format_sync_grp, diff --git a/.config/nvim/lua/treesitter.lua b/.config/nvim/lua/treesitter.lua index a09ad16..0e60da3 100644 --- a/.config/nvim/lua/treesitter.lua +++ b/.config/nvim/lua/treesitter.lua @@ -1,41 +1,25 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" (the four listed parsers should always be installed) - ensure_installed = {"rust", "c", "lua", "vim", "help" }, +require 'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "rust", "c", "lua", "vim", "help", "zig", "go" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, -- Automatically install missing parsers when entering buffer -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + auto_install = false, -- List of parsers to ignore installing (for "all") - ignore_install = { }, + ignore_install = {}, ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! highlight = { enable = false, - - -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to - -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is - -- the name of the parser) - -- list of language that will be disabled - disable = { }, - -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files - disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end - end, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, + }, + matchup = { + enable = true, -- mandatory, false will disable the whole extension + -- [options] }, } |
