From 4a432fbc261797090cdd330af31436071865ece0 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Thu, 20 Jan 2022 16:35:12 -0300 Subject: [PATCH] Added the old configuration, for reference --- .gitmodules | 6 +- fish/config.fish | 3 + nvim-old/init.vim | 171 +++++++++++++++++++++++++ nvim/init.lua | 40 +++--- nvim/pack/plugins/start/lspsaga.nvim | 1 - nvim/pack/plugins/start/vim-commentary | 1 + 6 files changed, 199 insertions(+), 23 deletions(-) create mode 100644 fish/config.fish create mode 100644 nvim-old/init.vim delete mode 160000 nvim/pack/plugins/start/lspsaga.nvim create mode 160000 nvim/pack/plugins/start/vim-commentary diff --git a/.gitmodules b/.gitmodules index 97dac54..10774a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ [submodule "nvim/pack/colors/start/molokai"] path = nvim/pack/colors/start/molokai url = https://github.com/tomasr/molokai.git -[submodule "nvim/pack/plugins/start/lspsaga.nvim"] - path = nvim/pack/plugins/start/lspsaga.nvim - url = https://github.com/glepnir/lspsaga.nvim.git [submodule "nvim/pack/plugins/start/nvim-treesitter"] path = nvim/pack/plugins/start/nvim-treesitter url = https://github.com/nvim-treesitter/nvim-treesitter.git [submodule "nvim/pack/plugins/start/lualine.nvim"] path = nvim/pack/plugins/start/lualine.nvim url = https://github.com/nvim-lualine/lualine.nvim.git +[submodule "nvim/pack/plugins/start/vim-commentary"] + path = nvim/pack/plugins/start/vim-commentary + url = https://github.com/tpope/vim-commentary.git diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..d714361 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,3 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end diff --git a/nvim-old/init.vim b/nvim-old/init.vim new file mode 100644 index 0000000..43bbec7 --- /dev/null +++ b/nvim-old/init.vim @@ -0,0 +1,171 @@ +" Colors {{{ +set t_Co=256 +set background=dark +let g:rehash256 = 1 +color molokai +" }}} + +" Functions {{{ +" Removes trailing spaces {{{ +function TrimWhiteSpace() + %s/\s\+$// + '' +endfunction +" }}} + +" Jump to alternate file {{{ +function JumpToAlternate() + let l:curr_path = expand("%:h") + let l:basename = expand("%:t") + if stridx(basename, "test_") == 0 + let l:new_file = l:basename[5:strlen(l:basename)] + else + let l:new_file = "test_" . l:basename + endif + let l:new_file = l:curr_path . '/' . l:new_file " WARN: Unixism + let l:buffer = bufnr(l:new_file) + if l:buffer == -1 + exe 'tabe ' .l:new_file + else + call win_gotoid(get(win_findbuf(l:buffer), 0)) + endif +endfunction +" }}} +" }}} + +" Settings for all files {{{ +set cursorline " highlight the line in which the cursor is +set foldmethod=marker " folding will use markers +set nowrap " instead of wrapping the text to the next line, scroll left and right +set laststatus=2 " Always display the status line +set showtabline=2 " Always display the tab bar +set scrolloff=2 " Lines around the cursor that should be visible +set splitright " Open new vertical splits on the right side, instead of left +set splitbelow " Opne new horizontal splits below the current on, not on top +let mapleader=" " " Leader (special character for plugins) is Space + +let g:rainbow_active = 1 " This is part of the Rainbow brackets, enabling it globally. +" }}} + +" Mappings {{{ +nnoremap - :Ex +nnoremap c :call TrimWhiteSpace() +" }}} + +" Plugin configuration {{{ +" Airline {{{ +let g:airline_theme='minimalist' +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#show_buffers = 0 +let g:airline#extensions#tabline#show_close_button = 0 +let g:airline#extensions#tabline#formatter = 'unique_tail' +" }}} + +" Skim {{{ +nmap :SK +" }}} + +" Polyglot {{{ +" let g:polyglot_disabled = ["csv"] +let g:polyglot_disabled = ['sensible', 'csv'] +" }}} + +" LanguageClient {{{ +" Available analyzers. +let g:LanguageClient_serverCommands = { + \ 'rust': ['rust-analyzer'], + \ 'python': ['pyls'], + \ } +" Display hints in the location list (default is QuickFix, which conflicts +" with `:grep`). +let g:LanguageClient_selectionUI = 'location-list' +let g:LanguageClient_diagnosticsList = 'Location' +" No signs in the gutter +let g:LanguageClient_diagnosticsSignsMax = 0 + +nnoremap ] :call LanguageClient#textDocument_definition() +nnoremap k :call LanguageClient#textDocument_hover() +nnoremap r :call LanguageClient#textDocument_rename() +nnoremap f :call LanguageClient#textDocument_codeAction() +nnoremap ? :call LanguageClient_contextMenu() +" }}} + +" }}} + +" Filetype specific configurations {{{ +" Vim files {{{ +au FileType vim setlocal noexpandtab " use real tabs +au FileType vim setlocal tabstop=4 " display tabs as 4 spaces +au FileType vim setlocal shiftwidth=4 " Use 4 spaces when auto-indenting +" }}} + +" Python {{{ +au FileType python setlocal number " show line numbers +au FileType python setlocal expandtab " use spaces instead of tabs +au FileType python setlocal tabstop=4 " number of spaces to use for indentation +au FileType python setlocal shiftwidth=4 " number of spaces to use for auto-indentation +au FileType python setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab +au FileType python setlocal textwidth=79 " max line size +au FileType python setlocal colorcolumn=80 " put a margin indicator +au FileType python au BufWritePre %s/\s\+$//e " When saving a Python file, remove tailing spaces +au FileType python nmap a :call JumpToAlternate() +" }}} + +" CSV files {{{ +au FileType csv setlocal list " Display special characters, like tabs (for TSV files) +" }}} + +" Rust {{{ +let g:rustfmt_autosave = 1 " Apply `rustfmt` when saving the file. + +au FileType rust setlocal number " show line numbers +au FileType rust setlocal expandtab " use spaces instead of tabs +au FileType rust setlocal tabstop=4 " number of spaces to use for indentation +au FileType rust setlocal shiftwidth=4 " number of spaces to use for auto-indentation +au FileType rust setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab +au FileType rust setlocal textwidth=79 " max line size +au FileType rust setlocal colorcolumn=80 " put a margin indicator +" }}} + +" Markdown {{{ +au FileType markdown setlocal spell " enable spell checking +au FileType markdown setlocal textwidth=79 " max line size +au FileType markdown setlocal expandtab " use spaces instead of tabs +" }}} + +" Shell {{{ +au FileType sh setlocal tabstop=4 " display tabs as 4 spaces +au FileType sh setlocal shiftwidth=4 " number of spaces to use for auto-indentation +au FileType sh setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab +" }}} + +" SQL {{{ +au FileType sql setlocal softtabstop=2 +au FileType sql setlocal shiftwidth=2 +au FileType sql setlocal tabstop=2 +" }}} + +" HTMLDjango {{{ +au FileType htmldjango setlocal tabstop=4 +au FileType htmldjango setlocal shiftwidth=4 +au FileType htmldjango setlocal softtabstop=4 +au FileType htmldjango setlocal list +au FileType htmldjango setlocal et +" }}} + +" HTML {{{ +au FileType html setlocal tabstop=4 +au FileType html setlocal shiftwidth=4 +au FileType html setlocal softtabstop=4 +au FileType html setlocal list +au FileType html setlocal et +" }}} +" }}} + +" GUI configuration {{{ +set guifont=Cascadia\ Mono:h40 +let g:neovide_no_idle=v:true +let g:neovide_fullscreen=v:true +let g:neovide_cursor_antialiasing=v:true +let g:neovide_cursor_animation_length=0.05 +" }}} diff --git a/nvim/init.lua b/nvim/init.lua index a60cbab..1ef5e03 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -39,10 +39,15 @@ local on_attach = function(client, bufnr) vim.wo.number = true vim.wo.colorcolumn = '80' - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'Lspsaga hover_doc', opts) - buf_set_keymap('n', 'C-K', 'Lspsaga signature_help', opts) + vim.diagnostic.config({signs = false}) + + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'gF', 'lua vim.lsp.buf.formatting()', opts) + buf_set_keymap('n', 'gR', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'g?', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'gp', 'lua vim.lsp.buf.completion()', opts) + buf_set_keymap('n', 'ge', 'lua vim.diagnostic.open_float()', opts) if client.resolved_capabilities.document_formatting then vim.api.nvim_command [[augroup Format]] @@ -62,16 +67,6 @@ nvim_lsp.pyright.setup { on_attach = on_attach } --- lsp saga improves the display of LSP information -local saga = require('lspsaga') -saga.init_lsp_saga { - error_sign = '>', - warn_sign = '#', - hint_sign = '!', - infor_sign = '?', - border_style = "round", -} - -- treesitter require 'nvim-treesitter.configs'.setup { ensure_installed = 'maintained', @@ -87,16 +82,23 @@ require 'lualine'.setup { icons_enabled = true, -- theme = 'ayu_dark', theme = 'ayu_mirage', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + component_separators = { left = ' ', right = ' '}, + section_separators = { left = ' ', right = ' '}, disabled_filetypes = {}, always_divide_middle = true, }, sections = { lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_b = {'branch'}, + lualine_c = { + { + 'diagnostics', + symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'}, + } + }, + lualine_d = {'filename'}, + lualine_w = {'encoding'}, + lualine_x = {'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, diff --git a/nvim/pack/plugins/start/lspsaga.nvim b/nvim/pack/plugins/start/lspsaga.nvim deleted file mode 160000 index cb0e35d..0000000 --- a/nvim/pack/plugins/start/lspsaga.nvim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cb0e35d2e594ff7a9c408d2e382945d56336c040 diff --git a/nvim/pack/plugins/start/vim-commentary b/nvim/pack/plugins/start/vim-commentary new file mode 160000 index 0000000..627308e --- /dev/null +++ b/nvim/pack/plugins/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 627308e30639be3e2d5402808ce18690557e8292