Compare commits

..

6 commits

9 changed files with 435 additions and 132 deletions

View file

@ -335,7 +335,7 @@
open-sans
overpass
(nerdfonts.override {
fonts = [ "FiraCode" "DroidSansMono" "Hack" "SourceCodePro" "RobotoMono" "Ubuntu" "UbuntuMono" ];
fonts = [ "FiraCode" "DroidSansMono" "Hack" "SourceCodePro" "RobotoMono" "Ubuntu" "UbuntuMono" "Iosevka" "IosevkaTerm"];
})
];

View file

@ -111,6 +111,7 @@ input "2:7:SynPS/2_Synaptics_TouchPad" {
# Start your launcher
bindsym $mod+d exec $menu
bindsym $mod+space exec $menu
bindsym $mod+slash exec $termmenu
# Drag floating windows by holding down $mod and left mouse button.

106
tycho/nvim/init.lua Normal file
View file

@ -0,0 +1,106 @@
require('plugins')
-- comma as leader
vim.g.mapleader = ","
-- load legacy options
vim.cmd([[
" so ~/.config/nvim/legacy.vim
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden'
let g:tex_flavor='latex'
]])
require('completion')
require('lsp-setup')
-- nvim-treesitter
require('nvim-treesitter.configs').setup {
ensure_installed = {
"c", "lua", "vim", "help", "query",
"gitattributes", "gitcommit", "gitignore",
"json", "markdown", "yaml", "toml",
"make", "nix", "bash",
"php", "html", "css",
"python", "rust",
},
highlight = {
enable = true,
},
}
-- lualine theme
require('lualine').setup {
options = {
theme = 'gruvbox',
-- no separators between lualine elements
section_separators = '',
component_separators = ''
}
}
-- to disable the default netrw file browser
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require("bufferline").setup{}
-- settings for neovide
if vim.g.neovide then
vim.o.guifont = "Iosevka Term Medium:h12"
end
vim.opt.backspace = "indent,eol,start"
-- fix auto-completion
vim.opt.wildmenu = true
vim.opt.wildignorecase = true
vim.opt.wildignore = "*.o,*~,*.pyc,*.aux,*.bbl,*.blg,*-blx.bib,*.log,*.out,*.run.xml,*.toc,*.nav,*.snm"
-- BUFFER HANDLING ---------------------------------
-- automatically reload files changed on disk but not in buffer
vim.opt.autoread = true
-- hide buffers on switch
vim.opt.hidden = true
-- OPTICS & NUMBERING BEHAVIOUR --------------------
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- keep 5 lines of context above/below the cursor (if possible)
vim.opt.scrolloff = 5
-- SEARCH ------------------------------------------
-- highlight all search results
vim.opt.hlsearch = true
-- enable smart-case search
vim.opt.smartcase = true
-- always case-insensitive
vim.opt.ignorecase = true
-- searches for strings incrementally
vim.opt.incsearch = true
-- key bindings
-- empty mode string matches n, v, o
vim.keymap.set("", "<leader>h", ":tabp<Enter>", { desc = "Select previous tab" })
vim.keymap.set("", "<leader>l", ":tabn<Enter>", { desc = "Select next tab" })
vim.keymap.set("", "<C-H>", ":bprevious<Enter>", { desc = "Select previous buffer" })
vim.keymap.set("", "<C-L>", ":bnext<Enter>", { desc = "Select next buffer" })
vim.keymap.set("", "<leader>f", ":Files<Enter>", { desc = "Open FZF file finder" })
vim.keymap.set("", "<leader>bl", ":Buffers<Enter>", { desc = "Open FZF buffer list" })
vim.keymap.set("n", "<space>1", "1<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>2", "2<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>3", "3<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>4", "4<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>5", "5<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>6", "6<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>7", "7<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>8", "8<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>9", "9<C-w>w", { noremap = true })
vim.keymap.set("n", "<space>0", "10<C-w>w", { noremap = true })

View file

@ -1,129 +0,0 @@
" this is enabled by default in nvim
" filetype plugin indent on
" syntax on
" enable autocompletion of ale
let g:ale_completion_enabled = 1
" disable latex linting from ale as i've got my own plugin for that
let g:ale_linters = {'rust': ['analyzer'], 'tex': []}
let g:ale_fixers = {'c': ['clang-format']}
" Initialize plugin system
call plug#begin(stdpath('data') . '/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/morhetz/gruvbox
" Plug 'morhetz/gruvbox'
Plug 'drewtempelmeyer/palenight.vim'
" Any valid git URL is allowed
Plug 'https://github.com/scrooloose/nerdcommenter.git'
" On-demand loading for languages
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
Plug 'cespare/vim-toml', { 'for': 'toml' }
Plug 'keith/swift.vim', { 'for': 'swift' }
" Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
Plug 'vim-syntastic/syntastic'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'justinmk/vim-sneak'
Plug 'lervag/vimtex'
Plug 'editorconfig/editorconfig-vim'
Plug 'LnL7/vim-nix'
Plug 'xevz/vim-squirrel'
Plug 'preservim/nerdtree'
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" ale language server client
Plug 'dense-analysis/ale'
" Initialize plugin system
call plug#end()
" open fzf files in new tab instead of new buffer
"command! -bang -nargs=? -complete=dir Files
"\ call fzf#vim#files(<q-args>, {'sink': 'tabedit', 'options': ['--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh {}']}, <bang>0)
set laststatus=2
let g:airline#extensions#tabline#enabled = 1
"let g:airline_powerline_fonts = 1
" window switching by #
let g:airline_section_c = '[%{winnr()}] %t'
nnoremap <space>1 1<C-w>w
nnoremap <space>2 2<C-w>w
nnoremap <space>3 3<C-w>w
nnoremap <space>4 4<C-w>w
nnoremap <space>5 5<C-w>w
nnoremap <space>6 6<C-w>w
nnoremap <space>7 7<C-w>w
nnoremap <space>8 8<C-w>w
nnoremap <space>9 9<C-w>w
nnoremap <space>0 10<C-w>w
" possible setting as alternative for easymotion
" let g:sneak#label = 1
set backspace=indent,eol,start
" map the leader key to ,
let mapleader=","
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden'
" Cycling through windows and tabs
" nnoremap j <C-W><C-J>
" nnoremap k <C-W><C-K>
" nnoremap l <C-W><C-L>
" nnoremap h <C-W><C-H>
" nnoremap <C-J> <C-W><C-J><C-W>_
" nnoremap <C-K> <C-W><C-K><C-W>_
" nnoremap <C-L> <C-W><C-L><C-W>\|
" nnoremap <C-H> <C-W><C-H><C-W>\|
map <leader>h :tabp<Enter>
map <leader>l :tabn<Enter>
map <C-H> :bprevious<Enter>
map <C-L> :bnext<Enter>
map <leader>f :Files<Enter>
map <leader>bl :Buffers<Enter>
" fix auto-completion
set wildmenu " show a completion menu
set wildignorecase
set wildignore=*.o,*~,*.pyc,*.aux,*.bbl,*.blg,*-blx.bib,*.log,*.out,*.run.xml,
\*.toc,*.nav,*.snm " ignore auxiliary files
" set completeopt-=preview
" automatically reload files changed on disk but not in buffer
set autoread
" hide buffers on switch
set hidden
" tex configuration
let g:tex_flavor='latex'
" Optics
colorscheme palenight "gruvbox
set background=dark " Setting dark mode
set number
set relativenumber
set tabstop=4
set shiftwidth=4
set expandtab
" keep 5 lines of context above/below the cursor (if possible)
set scrolloff=5
" Search
set hlsearch " Highlight all search results
set smartcase " Enable smart-case search
set ignorecase " Always case-insensitive
set incsearch " Searches for strings incrementally

126
tycho/nvim/legacy.vim Normal file
View file

@ -0,0 +1,126 @@
" this is enabled by default in nvim
" filetype plugin indent on
" syntax on
" enable autocompletion of ale
"let g:ale_completion_enabled = 1
" disable latex linting from ale as i've got my own plugin for that
"let g:ale_linters = {'rust': ['analyzer'], 'tex': []}
"let g:ale_fixers = {'c': ['clang-format']}
"" Initialize plugin system
"call plug#begin(stdpath('data') . '/plugged')
"" Make sure you use single quotes
"" Shorthand notation; fetches https://github.com/morhetz/gruvbox
"" Plug 'morhetz/gruvbox'
"Plug 'drewtempelmeyer/palenight.vim'
"" Any valid git URL is allowed
"Plug 'https://github.com/scrooloose/nerdcommenter.git'
"" On-demand loading for languages
"Plug 'rust-lang/rust.vim', { 'for': 'rust' }
"Plug 'cespare/vim-toml', { 'for': 'toml' }
"Plug 'keith/swift.vim', { 'for': 'swift' }
"" Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
"Plug 'vim-syntastic/syntastic'
"Plug 'vim-airline/vim-airline'
"Plug 'tpope/vim-fugitive'
"Plug 'airblade/vim-gitgutter'
"Plug 'justinmk/vim-sneak'
"Plug 'lervag/vimtex'
"Plug 'editorconfig/editorconfig-vim'
"Plug 'LnL7/vim-nix'
"Plug 'xevz/vim-squirrel'
"Plug 'preservim/nerdtree'
"" Plugin outside ~/.vim/plugged with post-update hook
"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
"Plug 'junegunn/fzf.vim'
"" ale language server client
"Plug 'dense-analysis/ale'
"" Initialize plugin system
"call plug#end()
" open fzf files in new tab instead of new buffer
"command! -bang -nargs=? -complete=dir Files
"\ call fzf#vim#files(<q-args>, {'sink': 'tabedit', 'options': ['--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh {}']}, <bang>0)
"set laststatus=2
"let g:airline#extensions#tabline#enabled = 1
"let g:airline_powerline_fonts = 1
" window switching by #
"let g:airline_section_c = '[%{winnr()}] %t'
"nnoremap <space>1 1<C-w>w
"nnoremap <space>2 2<C-w>w
"nnoremap <space>3 3<C-w>w
"nnoremap <space>4 4<C-w>w
"nnoremap <space>5 5<C-w>w
"nnoremap <space>6 6<C-w>w
"nnoremap <space>7 7<C-w>w
"nnoremap <space>8 8<C-w>w
"nnoremap <space>9 9<C-w>w
"nnoremap <space>0 10<C-w>w
" possible setting as alternative for easymotion
" let g:sneak#label = 1
"set backspace=indent,eol,start
"let $FZF_DEFAULT_COMMAND = 'rg --files --hidden'
" Cycling through windows and tabs
" nnoremap j <C-W><C-J>
" nnoremap k <C-W><C-K>
" nnoremap l <C-W><C-L>
" nnoremap h <C-W><C-H>
" nnoremap <C-J> <C-W><C-J><C-W>_
" nnoremap <C-K> <C-W><C-K><C-W>_
" nnoremap <C-L> <C-W><C-L><C-W>\|
" nnoremap <C-H> <C-W><C-H><C-W>\|
"map <leader>h :tabp<Enter>
"map <leader>l :tabn<Enter>
"map <C-H> :bprevious<Enter>
"map <C-L> :bnext<Enter>
"map <leader>f :Files<Enter>
"map <leader>bl :Buffers<Enter>
" fix auto-completion
"set wildmenu " show a completion menu
"set wildignorecase
"set wildignore=*.o,*~,*.pyc,*.aux,*.bbl,*.blg,*-blx.bib,*.log,*.out,*.run.xml,
"\*.toc,*.nav,*.snm " ignore auxiliary files
" set completeopt-=preview
" automatically reload files changed on disk but not in buffer
"set autoread
" hide buffers on switch
"set hidden
" tex configuration
"let g:tex_flavor='latex'
" Optics
"colorscheme palenight "gruvbox
"set background=dark " Setting dark mode
"set number
"set relativenumber
"set tabstop=4
"set shiftwidth=4
"set expandtab
" keep 5 lines of context above/below the cursor (if possible)
"set scrolloff=5
"" Search
"set hlsearch " Highlight all search results
"set smartcase " Enable smart-case search
"set ignorecase " Always case-insensitive
"set incsearch " Searches for strings incrementally

View file

@ -0,0 +1,67 @@
-- Set up nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently elected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip 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' },
})
})
-- 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(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Set up lspconfig.
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
--require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
--capabilities = capabilities
--}

View file

@ -0,0 +1,71 @@
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.api.nvim_set_keymap('n', ',e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
vim.api.nvim_set_keymap('n', 'ge', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gE', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
vim.api.nvim_set_keymap('n', ',q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
-- Use an on_attach function to only map the following keys
-- 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, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 's', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'i', ',s', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',qf', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',F', '<cmd>lua vim.lsp.buf.format { async = true }<CR>', opts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'clangd', 'rust_analyzer', 'nil_ls' }
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
}
}
end
require('lspconfig').clangd.setup{
on_attach = on_attach,
cmd = {
"clangd",
"--background-index",
"--pch-storage=memory",
"--clang-tidy",
"--suggest-missing-includes",
"--all-scopes-completion",
"--pretty",
"--header-insertion=never",
"-j=4",
"--inlay-hints",
"--header-insertion-decorators",
},
filetypes = {"c", "cpp", "objc", "objcpp"},
-- root_dir = utils.root_pattern("compile_commands.json", "compile_flags.txt", ".git")
init_option = { fallbackFlags = { "-std=c++2a" } }
}
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig').pyright.setup {
on_attach = on_attach,
capabilities = capabilities
}

View file

@ -0,0 +1,60 @@
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- theme
-- use {'morhetz/gruvbox', config = function() vim.cmd.colorscheme("gruvbox") end }
use {'luisiacc/gruvbox-baby', config = function() vim.cmd.colorscheme("gruvbox-baby") end }
-- use 'drewtempelmeyer/palenight.vim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
}
use {'akinsho/bufferline.nvim', tag = "*", requires = 'nvim-tree/nvim-web-devicons'}
use 'scrooloose/nerdcommenter'
use 'sbdchd/neoformat'
use {
'stevearc/oil.nvim',
requires = 'nvim-tree/nvim-web-devicons',
config = function() require('oil').setup() end
}
-- fuzzy file finder
use { 'junegunn/fzf', run = function() vim.fn['fzf#install'](0) end }
use 'junegunn/fzf.vim'
-- -- On-demand loading for languages
use 'rust-lang/rust.vim'
-- use 'cespare/vim-toml
-- use 'keith/swift.vim'
-- use 'neovimhaskell/haskell-vim'
-- Post-install/update hook with neovim command
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
-- LSP plugins
use 'neovim/nvim-lspconfig'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/nvim-cmp'
-- snippet engine
use 'hrsh7th/vim-vsnip'
use 'tpope/vim-fugitive'
-- use 'vim-syntastic/syntastic'
-- use 'vim-airline/vim-airline'
-- use 'airblade/vim-gitgutter'
-- use 'justinmk/vim-sneak'
-- use 'lervag/vimtex'
-- use 'editorconfig/editorconfig-vim'
-- use 'LnL7/vim-nix'
-- use 'xevz/vim-squirrel'
-- use 'preservim/nerdtree'
--
-- -- ale language server client
-- use 'dense-analysis/ale'
end)

View file

@ -105,7 +105,7 @@ font:
# - (macOS) Menlo
# - (Linux) monospace
# - (Windows) Consolas
family: "Iosevka Term Medium"
family: "IosevkaTerm NFM Medium"
#family: "Hack Nerd Font"
#family: "Menlo"
@ -341,7 +341,8 @@ working_directory: None
enable_experimental_conpty_backend: false
# Send ESC (\x1b) before characters when alt is pressed.
alt_send_esc: true
#alt_send_esc: true
# window.option_as_alt is the new option for this!
debug:
# Display the time it takes to redraw each frame.