diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-12-08 11:52:16 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-12-08 11:52:16 +0100 |
commit | 956df69d7496081db5e7b3621a0bcc7b9d7f7dfc (patch) | |
tree | 2c1de01541d70d1cbcb59974e42102440359f153 /nvim | |
parent | 1eca5dc0fe3648341e1707efc811162fc5056888 (diff) |
move to .config folder
Diffstat (limited to 'nvim')
-rw-r--r-- | nvim/init.vim | 192 | ||||
-rw-r--r-- | nvim/lua/git.lua | 29 | ||||
-rw-r--r-- | nvim/lua/lsp_conf.lua | 77 | ||||
-rw-r--r-- | nvim/lua/lualine_style.lua | 7 |
4 files changed, 0 insertions, 305 deletions
diff --git a/nvim/init.vim b/nvim/init.vim deleted file mode 100644 index 77f3cfb..0000000 --- a/nvim/init.vim +++ /dev/null @@ -1,192 +0,0 @@ -autocmd! bufwritepost .vimrc source % - -call plug#begin('~/.vim/plugged') -Plug 'cespare/vim-toml', { 'branch': 'main' } -"Plug 'rust-lang/rust.vim' -Plug 'nvim-lua/plenary.nvim' -Plug 'lewis6991/gitsigns.nvim' -Plug 'nvim-lualine/lualine.nvim' -Plug 'kyazdani42/nvim-web-devicons' -Plug 'luochen1990/rainbow' " color parentheses -Plug 'terryma/vim-multiple-cursors' -Plug 'tpope/vim-fugitive' " git extension for commit logs and etc. -Plug 'editorconfig/editorconfig-vim' -Plug 'ap/vim-css-color' -Plug 'Yggdroot/indentLine' - -Plug 'google/vim-searchindex' - -Plug 'kazhala/close-buffers.nvim' - -if has('nvim') - Plug 'rktjmp/lush.nvim' - Plug 'ellisonleao/gruvbox.nvim' - - Plug 'nvim-telescope/telescope.nvim' - Plug 'neovim/nvim-lspconfig' - Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} - Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} - Plug 'kyazdani42/nvim-tree.lua' - Plug 'ray-x/lsp_signature.nvim' - Plug 'folke/todo-comments.nvim' - Plug 'saecki/crates.nvim' - Plug 'gelguy/wilder.nvim', { 'do': ':UpdateRemotePlugins' } - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - - Plug 'jose-elias-alvarez/null-ls.nvim' - Plug 'folke/trouble.nvim' - Plug 'folke/lsp-colors.nvim' -endif - - -call plug#end() " required - -syntax on - -set runtimepath+=~/.vim-plugins/LanguageClient-neovim - -set completeopt=menu,menuone,noselect - -set clipboard=unnamed -set mouse=a " click with mouse -set wildmenu -set wildmode=longest,list:full -set wildignore=*~,*.png,*.jpg,*.gif,Thumbs.db,*.min.js,*.swp,*.o,vendor - -set number " number of the current line -set relativenumber " relative number, ..-2 -1 x 1 2, where x is current line -set textwidth=80 -set colorcolumn=80 -set nowrap -set fo-=t - -set tabstop=4 -set shiftwidth=4 -set expandtab " convert tabs in spaces - -set ai " auto indent -set autoread - -set encoding=UTF-8 -set history=1000 -set wildignore+=*.pyc - -set hlsearch " highlight search -set incsearch - -set nowritebackup -set laststatus=2 - -"set cursorline - -set list " spaces as characters -set listchars=eol:⏎,tab:»·,trail:ˑ,nbsp:⎵ - -set foldmethod=indent - -set splitright " split on right side -set lazyredraw -set ttyfast - -set noswapfile - -" rust -" let g:rustfmt_autosave = 1 -" let g:rustfmt_emit_files = 1 -" let g:rustfmt_fail_silently = 0 -" let g:rust_clip_command = 'xclip -selection clipboard' - -set termguicolors -set background=dark - -if has('nvim') - colorscheme gruvbox - highlight CursorLineNr ctermbg=NONE guibg=NONE - - lua require('lualine_style') - lua require('git') - let g:coq_settings = { 'auto_start': v:true } - lua require('lsp_conf') - - lua require('nvim-tree').setup() - lua require('todo-comments').setup() - - call wilder#setup({ - \ 'modes': [':', '/', '?'], - \ }) - call wilder#set_option('renderer', wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ - \ 'highlights': { - \ 'border': 'Normal', - \ }, - \ 'border': 'rounded', - \ 'left': [ - \ ' ', wilder#popupmenu_devicons(), - \ ], - \ }))) - lua require('nvim-treesitter.configs').setup({ highlight = { enable = true, }, }) - - lua require('lsp-colors').setup() - - nnoremap <leader>xx <cmd>TroubleToggle<cr> -else - colorscheme pablo -endif - -let g:indentLine_char = '¦' - -let g:netrw_liststyle=1 - -filetype plugin indent on -set nocompatible - -set showcmd " show commands at bottom - - -" nvim-tree -let g:nvim_tree_quit_on_open = 1 -let g:nvim_tree_highlight_opened_files = 1 -nnoremap <C-t> :NvimTreeToggle<CR> - -" ------------ -" MAPS -" ----------- -let mapleader = "," - -nnoremap j gj -nnoremap k gk - -nnoremap tn :tabnew<CR> -nnoremap <leader>rt :RainbowToggle<CR> - -" buffers -nnoremap ]b :bnext<CR> -nnoremap [b :bprev<CR> -nnoremap <leader>b <cmd>Telescope buffers<cr> - -" tabs -nnoremap ]t :tabn<CR> -nnoremap [t :tabp<CR> - -" only one window -nnoremap <leader>o :only<CR> - - -nnoremap <leader>ff <cmd>Telescope find_files<cr> -nnoremap <leader>fg <cmd>Telescope live_grep<cr> -nnoremap <leader>fh <cmd>Telescope help_tags<cr> - -nnoremap <leader>pa :set paste<CR> -nnoremap <leader>npa :set nopaste<CR> - - -nmap <leader>cr :!command cargo r<CR> -nmap <F6> :EditorConfigReload<CR> - -if &diff - "Get from remote - nnoremap dr :diffget<Space>RE<CR> - "Get from base - nnoremap db :diffget<Space>BA<CR> - "Get from local - nnoremap dl :diffget<Space>LO<CR> -endif diff --git a/nvim/lua/git.lua b/nvim/lua/git.lua deleted file mode 100644 index 2f9cbc4..0000000 --- a/nvim/lua/git.lua +++ /dev/null @@ -1,29 +0,0 @@ -require('gitsigns').setup { - signs = { - add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns.actions\".next_hunk()<CR>'"}, - ['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns.actions\".prev_hunk()<CR>'"}, - - ['n hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', - ['v hs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>', - ['n hS'] = '<cmd>lua require"gitsigns".stage_buffer()<CR>', - ['n hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>', - ['n hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', - ['n hB'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>', - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = true, -- Toggle with `:Gitsigns toggle_numhl` - watch_gitdir = { - interval = 1000, - follow_files = true - }, -} diff --git a/nvim/lua/lsp_conf.lua b/nvim/lua/lsp_conf.lua deleted file mode 100644 index e339a5c..0000000 --- a/nvim/lua/lsp_conf.lua +++ /dev/null @@ -1,77 +0,0 @@ -local nvim_lsp = require('lspconfig') -local coq = require('coq') -local null_ls = require("null-ls") -local trouble = require("trouble") - --- Redefine sign. -local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } - -for type, icon in pairs(signs) do - local hl = 'LspDiagnosticsSign' .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) -end - -local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end -local opts = { noremap=true, silent=true } - -null_ls.config({ - debug = false, - save_after_format = false, - sources = { - -- Python - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.isort, - null_ls.builtins.diagnostics.flake8, - -- Rust - null_ls.builtins.formatting.rustfmt, - -- C - null_ls.builtins.formatting.clang_format, - -- JS/TS - null_ls.builtins.formatting.prettier, - } -}) - --- Setup lspconfig. - ---- Use a loop to conveniently call 'setup' on multiple servers and --- map buffer local keybindings when the language server attaches -local servers = { 'pyright', 'rust_analyzer', 'tsserver', 'clangd' } -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { - capabilities = coq.lsp_ensure_capabilities(), - on_attach = function(client, bufnr) - client.resolved_capabilities.document_formatting = false - - require "lsp_signature".on_attach() - - -- Mappings. - local opts = { noremap=true, silent=true } - - -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) - buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) - buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) - buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) - buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) - end, - flags = { - debounce_text_changes = 150, - } - } -end - -nvim_lsp["null-ls"].setup({ - on_attach = function(client) - if client.resolved_capabilities.document_formatting then - buf_set_keymap('n', '<A-f>', '<cmd>lua vim.lsp.buf.formatting_sync()<cr>', opts) - vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()" - end - end -}) - -trouble.setup({ - use_lsp_diagnostic_signs = true, - auto_close = true, - auto_open = true -}) - diff --git a/nvim/lua/lualine_style.lua b/nvim/lua/lualine_style.lua deleted file mode 100644 index bb7738b..0000000 --- a/nvim/lua/lualine_style.lua +++ /dev/null @@ -1,7 +0,0 @@ -require'lualine'.setup{ - options = { - theme = 'powerline', - section_separators = { left = '', right = ''}, - component_separators = { left = '|', right = '|'}, - }, -} |