nix format doesn't like tabs

This commit is contained in:
Anish L 2022-03-17 00:56:53 +10:00
parent 779a0243d6
commit 49d9907b32

View file

@ -34,7 +34,7 @@ let
]; ];
python-with-my-packages = pkgs.python3.withPackages my-python-packages; python-with-my-packages = pkgs.python3.withPackages my-python-packages;
in in
{ {
environment.variables.EDITOR = "nvim"; environment.variables.EDITOR = "nvim";
environment.shellAliases = { environment.shellAliases = {
k = "cd ~/vimwiki; vim -c :VimwikiIndex"; k = "cd ~/vimwiki; vim -c :VimwikiIndex";
@ -49,7 +49,7 @@ in
vale vale
clj-kondo clj-kondo
# Other LSPs or linters # Other LSPs or linters
( neovim.override { (neovim.override {
vimAlias = true; vimAlias = true;
withPython3 = true; withPython3 = true;
extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; extraPython3Packages = pkgs: with pkgs; [ tasklib six ];
@ -171,6 +171,7 @@ in
" tabs " tabs
nmap <leader>rt :retab!<CR> nmap <leader>rt :retab!<CR>
vmap <leader>rt :retab!<CR>
let mapleader = "\<Space>" let mapleader = "\<Space>"
let maplocalleader = "," let maplocalleader = ","
@ -256,6 +257,9 @@ in
nmap <leader>gl :diffget //2 nmap <leader>gl :diffget //2
nmap <leader>gc :GBranches<CR> nmap <leader>gc :GBranches<CR>
nnoremap <leader>gp :Git! push<CR> nnoremap <leader>gp :Git! push<CR>
nnoremap <leader>gd :Gdiff<CR>
nnoremap <space>gt :Gcommit -v -q %:p<CR>
nnoremap <Leader>gb :Gblame<CR>
" kitaab " kitaab
map <leader>zs :ZettelSearch<CR> map <leader>zs :ZettelSearch<CR>
@ -269,13 +273,13 @@ in
nmap <Leader>sl :<C-u>SessionLoad<CR> nmap <Leader>sl :<C-u>SessionLoad<CR>
nnoremap <silent> <Leader>fh :DashboardFindHistory<CR> nnoremap <silent> <Leader>fh :DashboardFindHistory<CR>
nnoremap <silent> <Leader>ff :DashboardFindFile<CR> nnoremap <silent> <Leader>ff :DashboardFindFile<CR>
nnoremap <silent> <Leader>fa :DashboardFindWord<CR>
nnoremap <silent> <Leader>fm :DashboardJumpMark<CR> nnoremap <silent> <Leader>fm :DashboardJumpMark<CR>
nnoremap <silent> <Leader>cn :DashboardNewFile<CR> nnoremap <silent> <Leader>cn :DashboardNewFile<CR>
nnoremap <silent> <Leader>tn :tabnew<CR> nnoremap <silent> <Leader>tn :tabnew<CR>
autocmd FileType dashboard set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2 autocmd FileType dashboard set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2
" fzf " fzf
" not sure we even use this
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
" lsp commands " lsp commands
@ -286,33 +290,33 @@ in
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR> nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR> nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR> nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR> nnoremap <leader>vsd :lua rim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR> nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <leader>vll :call LspLocationList()<CR> nnoremap <leader>vll :call LspLocationList()<CR>
nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr> nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr>
" lua config " lua config
lua <<EOF lua <<EOF
-- autopairs -- autopairs
require('nvim-autopairs').setup{} require('nvim-autopairs').setup{}
-- Setup nvim-cmp. -- Setup nvim-cmp.
local has_words_before = function() local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
local luasnip = require("luasnip") local luasnip = require("luasnip")
local cmp = require('cmp') local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp') local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local t = function(str) local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true) return vim.api.nvim_replace_termcodes(str, true, true, true)
end end
local check_back_space = function() local check_back_space = function()
local col = vim.fn.col(".") - 1 local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil
end end
cmp.setup { cmp.setup {
formatting = { formatting = {
format = function(entry, vim_item) format = function(entry, vim_item)
-- fancy icons and a name of kind -- fancy icons and a name of kind
@ -370,30 +374,30 @@ cmp.setup {
{name = 'cmp-conjure'} {name = 'cmp-conjure'}
}, },
completion = {completeopt = 'menu,menuone,noinsert'} completion = {completeopt = 'menu,menuone,noinsert'}
} }
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } }))
-- TabNine cmp -- TabNine cmp
local tabnine = require('cmp_tabnine.config') local tabnine = require('cmp_tabnine.config')
tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true}) tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true})
-- Setup lspconfig -- Setup lspconfig
require("lsp-format").setup {} require("lsp-format").setup {}
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach}
require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach}
require('gitsigns').setup { sign_priority=80 } require('gitsigns').setup { sign_priority=80 }
-- treesitter -- treesitter
require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'typescript'}} require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'typescript'}}
-- lualine -- lualine
require('nvim-gps').setup {} require('nvim-gps').setup {}
local gps = require('nvim-gps') local gps = require('nvim-gps')
require('lualine').setup { require('lualine').setup {
sections = { sections = {
lualine_c = { lualine_c = {
'filename', { gps.get_location, condition=gps.is_available }, 'filename', { gps.get_location, condition=gps.is_available },
@ -416,23 +420,22 @@ require('lualine').setup {
end end
}, },
} }
} }
-- nvim-lint -- nvim-lint
require('lint').linters_by_ft = { require('lint').linters_by_ft = {
markdown = {'vale'}, markdown = {'vale'},
clojure = {'clj-kondo'}, }
python = {'black'}
}
-- f_term -- f_term
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
map('n', '<C-i>', '<CMD>lua require("FTerm").toggle()<CR>', opts) map('n', '<C-i>', '<CMD>lua require("FTerm").toggle()<CR>', opts)
map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts) map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
EOF EOF
''; '';
}; };
} }
)]; )
];
} }